From f857175540627347e7c3f0b9869caf9038af1d2b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 4 Nov 2022 00:39:37 -0400 Subject: [PATCH] feat: [run] Adds Cloud Run Jobs v2 API client libraries (#8723) --- .../google/cloud/run/v2/ExecutionsClient.java | 737 ++ .../cloud/run/v2/ExecutionsSettings.java | 241 + .../com/google/cloud/run/v2/JobsClient.java | 1317 +++ .../com/google/cloud/run/v2/JobsSettings.java | 335 + .../google/cloud/run/v2/RevisionsClient.java | 20 +- .../google/cloud/run/v2/ServicesClient.java | 24 +- .../com/google/cloud/run/v2/TasksClient.java | 550 ++ .../google/cloud/run/v2/TasksSettings.java | 215 + .../google/cloud/run/v2/gapic_metadata.json | 69 + .../com/google/cloud/run/v2/package-info.java | 54 + .../cloud/run/v2/stub/ExecutionsStub.java | 74 + .../run/v2/stub/ExecutionsStubSettings.java | 477 ++ .../stub/GrpcExecutionsCallableFactory.java | 113 + .../cloud/run/v2/stub/GrpcExecutionsStub.java | 251 + .../run/v2/stub/GrpcJobsCallableFactory.java | 113 + .../cloud/run/v2/stub/GrpcJobsStub.java | 452 + .../run/v2/stub/GrpcTasksCallableFactory.java | 113 + .../cloud/run/v2/stub/GrpcTasksStub.java | 196 + .../HttpJsonExecutionsCallableFactory.java | 105 + .../run/v2/stub/HttpJsonExecutionsStub.java | 340 + .../v2/stub/HttpJsonJobsCallableFactory.java | 105 + .../cloud/run/v2/stub/HttpJsonJobsStub.java | 689 ++ .../v2/stub/HttpJsonTasksCallableFactory.java | 105 + .../cloud/run/v2/stub/HttpJsonTasksStub.java | 252 + .../google/cloud/run/v2/stub/JobsStub.java | 118 + .../cloud/run/v2/stub/JobsStubSettings.java | 732 ++ .../google/cloud/run/v2/stub/TasksStub.java | 52 + .../cloud/run/v2/stub/TasksStubSettings.java | 396 + .../run/v2/ExecutionsClientHttpJsonTest.java | 461 + .../cloud/run/v2/ExecutionsClientTest.java | 435 + .../cloud/run/v2/JobsClientHttpJsonTest.java | 1042 +++ .../google/cloud/run/v2/JobsClientTest.java | 944 +++ .../google/cloud/run/v2/MockExecutions.java | 59 + .../cloud/run/v2/MockExecutionsImpl.java | 124 + .../com/google/cloud/run/v2/MockJobs.java | 59 + .../com/google/cloud/run/v2/MockJobsImpl.java | 248 + .../com/google/cloud/run/v2/MockTasks.java | 59 + .../google/cloud/run/v2/MockTasksImpl.java | 101 + .../cloud/run/v2/TasksClientHttpJsonTest.java | 330 + .../google/cloud/run/v2/TasksClientTest.java | 308 + .../google/cloud/run/v2/ExecutionsGrpc.java | 578 ++ .../com/google/cloud/run/v2/JobsGrpc.java | 1210 +++ .../google/cloud/run/v2/RevisionsGrpc.java | 16 +- .../com/google/cloud/run/v2/ServicesGrpc.java | 16 +- .../com/google/cloud/run/v2/TasksGrpc.java | 448 + .../google/cloud/run/v2/CreateJobRequest.java | 1171 +++ .../run/v2/CreateJobRequestOrBuilder.java | 132 + .../cloud/run/v2/CreateServiceRequest.java | 14 +- .../run/v2/CreateServiceRequestOrBuilder.java | 4 +- .../cloud/run/v2/DeleteExecutionRequest.java | 922 ++ .../v2/DeleteExecutionRequestOrBuilder.java | 99 + .../google/cloud/run/v2/DeleteJobRequest.java | 914 ++ .../run/v2/DeleteJobRequestOrBuilder.java | 97 + .../com/google/cloud/run/v2/Execution.java | 5516 ++++++++++++ .../google/cloud/run/v2/ExecutionName.java | 257 + .../cloud/run/v2/ExecutionOrBuilder.java | 809 ++ .../google/cloud/run/v2/ExecutionProto.java | 252 + .../cloud/run/v2/ExecutionReference.java | 1146 +++ .../run/v2/ExecutionReferenceOrBuilder.java | 120 + .../cloud/run/v2/ExecutionTemplate.java | 1568 ++++ .../run/v2/ExecutionTemplateOrBuilder.java | 217 + .../cloud/run/v2/ExecutionTemplateProto.java | 109 + .../cloud/run/v2/GetExecutionRequest.java | 642 ++ .../run/v2/GetExecutionRequestOrBuilder.java | 58 + .../google/cloud/run/v2/GetJobRequest.java | 633 ++ .../cloud/run/v2/GetJobRequestOrBuilder.java | 56 + .../google/cloud/run/v2/GetTaskRequest.java | 641 ++ .../cloud/run/v2/GetTaskRequestOrBuilder.java | 58 + .../java/com/google/cloud/run/v2/Job.java | 5995 +++++++++++++ .../java/com/google/cloud/run/v2/JobName.java | 216 + .../com/google/cloud/run/v2/JobOrBuilder.java | 890 ++ .../com/google/cloud/run/v2/JobProto.java | 341 + .../cloud/run/v2/ListExecutionsRequest.java | 1009 +++ .../v2/ListExecutionsRequestOrBuilder.java | 111 + .../cloud/run/v2/ListExecutionsResponse.java | 1109 +++ .../v2/ListExecutionsResponseOrBuilder.java | 103 + .../google/cloud/run/v2/ListJobsRequest.java | 1001 +++ .../run/v2/ListJobsRequestOrBuilder.java | 109 + .../google/cloud/run/v2/ListJobsResponse.java | 1100 +++ .../run/v2/ListJobsResponseOrBuilder.java | 103 + .../google/cloud/run/v2/ListTasksRequest.java | 1015 +++ .../run/v2/ListTasksRequestOrBuilder.java | 113 + .../cloud/run/v2/ListTasksResponse.java | 1101 +++ .../run/v2/ListTasksResponseOrBuilder.java | 103 + .../google/cloud/run/v2/RunJobRequest.java | 913 ++ .../cloud/run/v2/RunJobRequestOrBuilder.java | 97 + .../java/com/google/cloud/run/v2/Task.java | 7417 +++++++++++++++++ .../cloud/run/v2/TaskAttemptResult.java | 803 ++ .../run/v2/TaskAttemptResultOrBuilder.java | 79 + .../com/google/cloud/run/v2/TaskName.java | 289 + .../google/cloud/run/v2/TaskOrBuilder.java | 1046 +++ .../com/google/cloud/run/v2/TaskProto.java | 258 + .../com/google/cloud/run/v2/TaskTemplate.java | 2741 ++++++ .../cloud/run/v2/TaskTemplateOrBuilder.java | 323 + .../cloud/run/v2/TaskTemplateProto.java | 99 + .../google/cloud/run/v2/UpdateJobRequest.java | 885 ++ .../run/v2/UpdateJobRequestOrBuilder.java | 89 + .../proto/google/cloud/run/v2/execution.proto | 259 + .../cloud/run/v2/execution_template.proto | 54 + .../main/proto/google/cloud/run/v2/job.proto | 400 + .../proto/google/cloud/run/v2/revision.proto | 16 +- .../cloud/run/v2/revision_template.proto | 10 +- .../proto/google/cloud/run/v2/service.proto | 18 +- .../main/proto/google/cloud/run/v2/task.proto | 256 + .../google/cloud/run/v2/task_template.proto | 68 + .../SyncCreateSetCredentialsProvider.java | 44 + .../SyncCreateSetCredentialsProvider1.java | 39 + .../create/SyncCreateSetEndpoint.java | 41 + .../deleteexecution/AsyncDeleteExecution.java | 52 + .../AsyncDeleteExecutionLRO.java | 53 + .../deleteexecution/SyncDeleteExecution.java | 49 + .../SyncDeleteExecutionExecutionname.java | 42 + .../SyncDeleteExecutionString.java | 42 + .../getexecution/AsyncGetExecution.java | 50 + .../getexecution/SyncGetExecution.java | 47 + .../SyncGetExecutionExecutionname.java | 42 + .../getexecution/SyncGetExecutionString.java | 42 + .../listexecutions/AsyncListExecutions.java | 55 + .../AsyncListExecutionsPaged.java | 62 + .../listexecutions/SyncListExecutions.java | 51 + .../SyncListExecutionsJobname.java | 44 + .../SyncListExecutionsString.java | 44 + .../getexecution/SyncGetExecution.java | 45 + .../SyncCreateSetCredentialsProvider.java | 44 + .../SyncCreateSetCredentialsProvider1.java | 39 + .../v2/jobs/create/SyncCreateSetEndpoint.java | 40 + .../run/v2/jobs/createjob/AsyncCreateJob.java | 53 + .../v2/jobs/createjob/AsyncCreateJobLRO.java | 53 + .../run/v2/jobs/createjob/SyncCreateJob.java | 49 + .../SyncCreateJobLocationnameJobString.java | 44 + .../SyncCreateJobStringJobString.java | 44 + .../run/v2/jobs/deletejob/AsyncDeleteJob.java | 51 + .../v2/jobs/deletejob/AsyncDeleteJobLRO.java | 52 + .../run/v2/jobs/deletejob/SyncDeleteJob.java | 48 + .../jobs/deletejob/SyncDeleteJobJobname.java | 42 + .../jobs/deletejob/SyncDeleteJobString.java | 42 + .../jobs/getiampolicy/AsyncGetIamPolicy.java | 51 + .../jobs/getiampolicy/SyncGetIamPolicy.java | 48 + .../cloud/run/v2/jobs/getjob/AsyncGetJob.java | 49 + .../cloud/run/v2/jobs/getjob/SyncGetJob.java | 46 + .../run/v2/jobs/getjob/SyncGetJobJobname.java | 42 + .../run/v2/jobs/getjob/SyncGetJobString.java | 42 + .../run/v2/jobs/listjobs/AsyncListJobs.java | 54 + .../v2/jobs/listjobs/AsyncListJobsPaged.java | 62 + .../run/v2/jobs/listjobs/SyncListJobs.java | 51 + .../listjobs/SyncListJobsLocationname.java | 44 + .../v2/jobs/listjobs/SyncListJobsString.java | 44 + .../cloud/run/v2/jobs/runjob/AsyncRunJob.java | 51 + .../run/v2/jobs/runjob/AsyncRunJobLRO.java | 52 + .../cloud/run/v2/jobs/runjob/SyncRunJob.java | 48 + .../run/v2/jobs/runjob/SyncRunJobJobname.java | 42 + .../run/v2/jobs/runjob/SyncRunJobString.java | 42 + .../jobs/setiampolicy/AsyncSetIamPolicy.java | 52 + .../jobs/setiampolicy/SyncSetIamPolicy.java | 49 + .../AsyncTestIamPermissions.java | 52 + .../SyncTestIamPermissions.java | 48 + .../run/v2/jobs/updatejob/AsyncUpdateJob.java | 51 + .../v2/jobs/updatejob/AsyncUpdateJobLRO.java | 51 + .../run/v2/jobs/updatejob/SyncUpdateJob.java | 47 + .../v2/jobs/updatejob/SyncUpdateJobJob.java | 41 + .../v2/jobssettings/getjob/SyncGetJob.java | 45 + .../getexecution/SyncGetExecution.java | 45 + .../jobsstubsettings/getjob/SyncGetJob.java | 45 + .../gettask/SyncGetTask.java | 45 + .../SyncCreateSetCredentialsProvider.java | 44 + .../SyncCreateSetCredentialsProvider1.java | 39 + .../tasks/create/SyncCreateSetEndpoint.java | 40 + .../run/v2/tasks/gettask/AsyncGetTask.java | 51 + .../run/v2/tasks/gettask/SyncGetTask.java | 48 + .../v2/tasks/gettask/SyncGetTaskString.java | 43 + .../v2/tasks/gettask/SyncGetTaskTaskname.java | 42 + .../v2/tasks/listtasks/AsyncListTasks.java | 55 + .../tasks/listtasks/AsyncListTasksPaged.java | 63 + .../run/v2/tasks/listtasks/SyncListTasks.java | 52 + .../listtasks/SyncListTasksExecutionname.java | 44 + .../tasks/listtasks/SyncListTasksString.java | 45 + .../v2/taskssettings/gettask/SyncGetTask.java | 45 + 177 files changed, 63984 insertions(+), 68 deletions(-) create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/ExecutionsClient.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/ExecutionsSettings.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/JobsClient.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/JobsSettings.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/TasksClient.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/TasksSettings.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/ExecutionsStub.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/ExecutionsStubSettings.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcExecutionsCallableFactory.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcExecutionsStub.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcJobsCallableFactory.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcJobsStub.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcTasksCallableFactory.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcTasksStub.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonExecutionsCallableFactory.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonExecutionsStub.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonJobsCallableFactory.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonJobsStub.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonTasksCallableFactory.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonTasksStub.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/JobsStub.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/JobsStubSettings.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/TasksStub.java create mode 100644 java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/TasksStubSettings.java create mode 100644 java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/ExecutionsClientHttpJsonTest.java create mode 100644 java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/ExecutionsClientTest.java create mode 100644 java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/JobsClientHttpJsonTest.java create mode 100644 java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/JobsClientTest.java create mode 100644 java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockExecutions.java create mode 100644 java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockExecutionsImpl.java create mode 100644 java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockJobs.java create mode 100644 java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockJobsImpl.java create mode 100644 java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockTasks.java create mode 100644 java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockTasksImpl.java create mode 100644 java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/TasksClientHttpJsonTest.java create mode 100644 java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/TasksClientTest.java create mode 100644 java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionsGrpc.java create mode 100644 java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobsGrpc.java create mode 100644 java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TasksGrpc.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateJobRequest.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateJobRequestOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteExecutionRequest.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteExecutionRequestOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteJobRequest.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteJobRequestOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/Execution.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionName.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionProto.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionReference.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionReferenceOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionTemplate.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionTemplateOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionTemplateProto.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetExecutionRequest.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetExecutionRequestOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetJobRequest.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetJobRequestOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetTaskRequest.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetTaskRequestOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/Job.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobName.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobProto.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsRequest.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsRequestOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsResponse.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsResponseOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsRequest.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsRequestOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsResponse.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsResponseOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksRequest.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksRequestOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksResponse.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksResponseOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/RunJobRequest.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/RunJobRequestOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/Task.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskAttemptResult.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskAttemptResultOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskName.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskProto.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskTemplate.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskTemplateOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskTemplateProto.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/UpdateJobRequest.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/UpdateJobRequestOrBuilder.java create mode 100644 java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/execution.proto create mode 100644 java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/execution_template.proto create mode 100644 java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/job.proto create mode 100644 java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/task.proto create mode 100644 java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/task_template.proto create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/create/SyncCreateSetCredentialsProvider.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/create/SyncCreateSetCredentialsProvider1.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/create/SyncCreateSetEndpoint.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/AsyncDeleteExecution.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/AsyncDeleteExecutionLRO.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/SyncDeleteExecution.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/SyncDeleteExecutionExecutionname.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/SyncDeleteExecutionString.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/AsyncGetExecution.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/SyncGetExecution.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/SyncGetExecutionExecutionname.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/SyncGetExecutionString.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/AsyncListExecutions.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/AsyncListExecutionsPaged.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/SyncListExecutions.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/SyncListExecutionsJobname.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/SyncListExecutionsString.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/executionssettings/getexecution/SyncGetExecution.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/create/SyncCreateSetCredentialsProvider.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/create/SyncCreateSetCredentialsProvider1.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/create/SyncCreateSetEndpoint.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/AsyncCreateJob.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/AsyncCreateJobLRO.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/SyncCreateJob.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/SyncCreateJobLocationnameJobString.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/SyncCreateJobStringJobString.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/AsyncDeleteJob.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/AsyncDeleteJobLRO.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/SyncDeleteJob.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/SyncDeleteJobJobname.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/SyncDeleteJobString.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getiampolicy/AsyncGetIamPolicy.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getiampolicy/SyncGetIamPolicy.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/AsyncGetJob.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/SyncGetJob.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/SyncGetJobJobname.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/SyncGetJobString.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/AsyncListJobs.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/AsyncListJobsPaged.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/SyncListJobs.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/SyncListJobsLocationname.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/SyncListJobsString.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/AsyncRunJob.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/AsyncRunJobLRO.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/SyncRunJob.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/SyncRunJobJobname.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/SyncRunJobString.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/setiampolicy/AsyncSetIamPolicy.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/setiampolicy/SyncSetIamPolicy.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/testiampermissions/AsyncTestIamPermissions.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/testiampermissions/SyncTestIamPermissions.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/AsyncUpdateJob.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/AsyncUpdateJobLRO.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/SyncUpdateJob.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/SyncUpdateJobJob.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/jobssettings/getjob/SyncGetJob.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/stub/executionsstubsettings/getexecution/SyncGetExecution.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/stub/jobsstubsettings/getjob/SyncGetJob.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/stub/tasksstubsettings/gettask/SyncGetTask.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/create/SyncCreateSetCredentialsProvider.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/create/SyncCreateSetCredentialsProvider1.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/create/SyncCreateSetEndpoint.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/AsyncGetTask.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/SyncGetTask.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/SyncGetTaskString.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/SyncGetTaskTaskname.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/AsyncListTasks.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/AsyncListTasksPaged.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/SyncListTasks.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/SyncListTasksExecutionname.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/SyncListTasksString.java create mode 100644 java-run/samples/snippets/generated/com/google/cloud/run/v2/taskssettings/gettask/SyncGetTask.java diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/ExecutionsClient.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/ExecutionsClient.java new file mode 100644 index 000000000000..621b60bdfef2 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/ExecutionsClient.java @@ -0,0 +1,737 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +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; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.run.v2.stub.ExecutionsStub; +import com.google.cloud.run.v2.stub.ExecutionsStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Cloud Run Execution Control Plane API. + * + *

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

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+ *   ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]");
+ *   Execution response = executionsClient.getExecution(name);
+ * }
+ * }
+ * + *

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

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of ExecutionsSettings to + * create(). For example: + * + *

To customize credentials: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * ExecutionsSettings executionsSettings =
+ *     ExecutionsSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * ExecutionsClient executionsClient = ExecutionsClient.create(executionsSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * ExecutionsSettings executionsSettings =
+ *     ExecutionsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * ExecutionsClient executionsClient = ExecutionsClient.create(executionsSettings);
+ * }
+ * + *

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 and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * ExecutionsSettings executionsSettings = ExecutionsSettings.newHttpJsonBuilder().build();
+ * ExecutionsClient executionsClient = ExecutionsClient.create(executionsSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class ExecutionsClient implements BackgroundResource { + private final ExecutionsSettings settings; + private final ExecutionsStub stub; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; + + /** Constructs an instance of ExecutionsClient with default settings. */ + public static final ExecutionsClient create() throws IOException { + return create(ExecutionsSettings.newBuilder().build()); + } + + /** + * Constructs an instance of ExecutionsClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final ExecutionsClient create(ExecutionsSettings settings) throws IOException { + return new ExecutionsClient(settings); + } + + /** + * Constructs an instance of ExecutionsClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(ExecutionsSettings). + */ + public static final ExecutionsClient create(ExecutionsStub stub) { + return new ExecutionsClient(stub); + } + + /** + * Constructs an instance of ExecutionsClient, 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 ExecutionsClient(ExecutionsSettings settings) throws IOException { + this.settings = settings; + this.stub = ((ExecutionsStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + protected ExecutionsClient(ExecutionsStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + public final ExecutionsSettings getSettings() { + return settings; + } + + public ExecutionsStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + 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. + */ + @BetaApi + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about an Execution. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]");
+   *   Execution response = executionsClient.getExecution(name);
+   * }
+   * }
+ * + * @param name Required. The full name of the Execution. Format: + * projects/{project}/locations/{location}/jobs/{job}/executions/{execution} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Execution getExecution(ExecutionName name) { + GetExecutionRequest request = + GetExecutionRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getExecution(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about an Execution. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   String name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString();
+   *   Execution response = executionsClient.getExecution(name);
+   * }
+   * }
+ * + * @param name Required. The full name of the Execution. Format: + * projects/{project}/locations/{location}/jobs/{job}/executions/{execution} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Execution getExecution(String name) { + GetExecutionRequest request = GetExecutionRequest.newBuilder().setName(name).build(); + return getExecution(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about an Execution. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   GetExecutionRequest request =
+   *       GetExecutionRequest.newBuilder()
+   *           .setName(
+   *               ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString())
+   *           .build();
+   *   Execution response = executionsClient.getExecution(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Execution getExecution(GetExecutionRequest request) { + return getExecutionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about an Execution. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   GetExecutionRequest request =
+   *       GetExecutionRequest.newBuilder()
+   *           .setName(
+   *               ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString())
+   *           .build();
+   *   ApiFuture future = executionsClient.getExecutionCallable().futureCall(request);
+   *   // Do something.
+   *   Execution response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getExecutionCallable() { + return stub.getExecutionCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Executions from a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   JobName parent = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+   *   for (Execution element : executionsClient.listExecutions(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The Execution from which the Executions should be listed. To list all + * Executions across Jobs, use "-" instead of Job name. Format: + * projects/{project}/locations/{location}/jobs/{job} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListExecutionsPagedResponse listExecutions(JobName parent) { + ListExecutionsRequest request = + ListExecutionsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listExecutions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Executions from a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   String parent = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   for (Execution element : executionsClient.listExecutions(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The Execution from which the Executions should be listed. To list all + * Executions across Jobs, use "-" instead of Job name. Format: + * projects/{project}/locations/{location}/jobs/{job} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListExecutionsPagedResponse listExecutions(String parent) { + ListExecutionsRequest request = ListExecutionsRequest.newBuilder().setParent(parent).build(); + return listExecutions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Executions from a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   ListExecutionsRequest request =
+   *       ListExecutionsRequest.newBuilder()
+   *           .setParent(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   for (Execution element : executionsClient.listExecutions(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @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 ListExecutionsPagedResponse listExecutions(ListExecutionsRequest request) { + return listExecutionsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Executions from a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   ListExecutionsRequest request =
+   *       ListExecutionsRequest.newBuilder()
+   *           .setParent(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   ApiFuture future =
+   *       executionsClient.listExecutionsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Execution element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listExecutionsPagedCallable() { + return stub.listExecutionsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Executions from a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   ListExecutionsRequest request =
+   *       ListExecutionsRequest.newBuilder()
+   *           .setParent(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   while (true) {
+   *     ListExecutionsResponse response = executionsClient.listExecutionsCallable().call(request);
+   *     for (Execution element : response.getExecutionsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listExecutionsCallable() { + return stub.listExecutionsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes an Execution. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]");
+   *   Execution response = executionsClient.deleteExecutionAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the Execution to delete. Format: + * projects/{project}/locations/{location}/jobs/{job}/executions/{execution} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteExecutionAsync(ExecutionName name) { + DeleteExecutionRequest request = + DeleteExecutionRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return deleteExecutionAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes an Execution. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   String name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString();
+   *   Execution response = executionsClient.deleteExecutionAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The name of the Execution to delete. Format: + * projects/{project}/locations/{location}/jobs/{job}/executions/{execution} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteExecutionAsync(String name) { + DeleteExecutionRequest request = DeleteExecutionRequest.newBuilder().setName(name).build(); + return deleteExecutionAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes an Execution. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   DeleteExecutionRequest request =
+   *       DeleteExecutionRequest.newBuilder()
+   *           .setName(
+   *               ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   Execution response = executionsClient.deleteExecutionAsync(request).get();
+   * }
+   * }
+ * + * @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 OperationFuture deleteExecutionAsync( + DeleteExecutionRequest request) { + return deleteExecutionOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes an Execution. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   DeleteExecutionRequest request =
+   *       DeleteExecutionRequest.newBuilder()
+   *           .setName(
+   *               ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   OperationFuture future =
+   *       executionsClient.deleteExecutionOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Execution response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + deleteExecutionOperationCallable() { + return stub.deleteExecutionOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes an Execution. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   DeleteExecutionRequest request =
+   *       DeleteExecutionRequest.newBuilder()
+   *           .setName(
+   *               ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   ApiFuture future = executionsClient.deleteExecutionCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deleteExecutionCallable() { + return stub.deleteExecutionCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListExecutionsPagedResponse + extends AbstractPagedListResponse< + ListExecutionsRequest, + ListExecutionsResponse, + Execution, + ListExecutionsPage, + ListExecutionsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListExecutionsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + input -> new ListExecutionsPagedResponse(input), + MoreExecutors.directExecutor()); + } + + private ListExecutionsPagedResponse(ListExecutionsPage page) { + super(page, ListExecutionsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListExecutionsPage + extends AbstractPage< + ListExecutionsRequest, ListExecutionsResponse, Execution, ListExecutionsPage> { + + private ListExecutionsPage( + PageContext context, + ListExecutionsResponse response) { + super(context, response); + } + + private static ListExecutionsPage createEmptyPage() { + return new ListExecutionsPage(null, null); + } + + @Override + protected ListExecutionsPage createPage( + PageContext context, + ListExecutionsResponse response) { + return new ListExecutionsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListExecutionsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListExecutionsRequest, + ListExecutionsResponse, + Execution, + ListExecutionsPage, + ListExecutionsFixedSizeCollection> { + + private ListExecutionsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListExecutionsFixedSizeCollection createEmptyCollection() { + return new ListExecutionsFixedSizeCollection(null, 0); + } + + @Override + protected ListExecutionsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListExecutionsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/ExecutionsSettings.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/ExecutionsSettings.java new file mode 100644 index 000000000000..81e9e38d3ec6 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/ExecutionsSettings.java @@ -0,0 +1,241 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import static com.google.cloud.run.v2.ExecutionsClient.ListExecutionsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +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; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.run.v2.stub.ExecutionsStubSettings; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link ExecutionsClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (run.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getExecution to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * ExecutionsSettings.Builder executionsSettingsBuilder = ExecutionsSettings.newBuilder();
+ * executionsSettingsBuilder
+ *     .getExecutionSettings()
+ *     .setRetrySettings(
+ *         executionsSettingsBuilder.getExecutionSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * ExecutionsSettings executionsSettings = executionsSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class ExecutionsSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to getExecution. */ + public UnaryCallSettings getExecutionSettings() { + return ((ExecutionsStubSettings) getStubSettings()).getExecutionSettings(); + } + + /** Returns the object with the settings used for calls to listExecutions. */ + public PagedCallSettings< + ListExecutionsRequest, ListExecutionsResponse, ListExecutionsPagedResponse> + listExecutionsSettings() { + return ((ExecutionsStubSettings) getStubSettings()).listExecutionsSettings(); + } + + /** Returns the object with the settings used for calls to deleteExecution. */ + public UnaryCallSettings deleteExecutionSettings() { + return ((ExecutionsStubSettings) getStubSettings()).deleteExecutionSettings(); + } + + /** Returns the object with the settings used for calls to deleteExecution. */ + public OperationCallSettings + deleteExecutionOperationSettings() { + return ((ExecutionsStubSettings) getStubSettings()).deleteExecutionOperationSettings(); + } + + public static final ExecutionsSettings create(ExecutionsStubSettings stub) throws IOException { + return new ExecutionsSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return ExecutionsStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return ExecutionsStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return ExecutionsStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return ExecutionsStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return ExecutionsStubSettings.defaultGrpcTransportProviderBuilder(); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return ExecutionsStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return ExecutionsStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ExecutionsStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** 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); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ExecutionsSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for ExecutionsSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(ExecutionsStubSettings.newBuilder(clientContext)); + } + + protected Builder(ExecutionsSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(ExecutionsStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(ExecutionsStubSettings.newBuilder()); + } + + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(ExecutionsStubSettings.newHttpJsonBuilder()); + } + + public ExecutionsStubSettings.Builder getStubSettingsBuilder() { + return ((ExecutionsStubSettings.Builder) getStubSettings()); + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to getExecution. */ + public UnaryCallSettings.Builder getExecutionSettings() { + return getStubSettingsBuilder().getExecutionSettings(); + } + + /** Returns the builder for the settings used for calls to listExecutions. */ + public PagedCallSettings.Builder< + ListExecutionsRequest, ListExecutionsResponse, ListExecutionsPagedResponse> + listExecutionsSettings() { + return getStubSettingsBuilder().listExecutionsSettings(); + } + + /** Returns the builder for the settings used for calls to deleteExecution. */ + public UnaryCallSettings.Builder deleteExecutionSettings() { + return getStubSettingsBuilder().deleteExecutionSettings(); + } + + /** Returns the builder for the settings used for calls to deleteExecution. */ + public OperationCallSettings.Builder + deleteExecutionOperationSettings() { + return getStubSettingsBuilder().deleteExecutionOperationSettings(); + } + + @Override + public ExecutionsSettings build() throws IOException { + return new ExecutionsSettings(this); + } + } +} diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/JobsClient.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/JobsClient.java new file mode 100644 index 000000000000..3b39d826d2ae --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/JobsClient.java @@ -0,0 +1,1317 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +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; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.run.v2.stub.JobsStub; +import com.google.cloud.run.v2.stub.JobsStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Cloud Run Job Control Plane API. + * + *

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

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (JobsClient jobsClient = JobsClient.create()) {
+ *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+ *   Job response = jobsClient.getJob(name);
+ * }
+ * }
+ * + *

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

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of JobsSettings to create(). For + * example: + * + *

To customize credentials: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * JobsSettings jobsSettings =
+ *     JobsSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * JobsClient jobsClient = JobsClient.create(jobsSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * JobsSettings jobsSettings = JobsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * JobsClient jobsClient = JobsClient.create(jobsSettings);
+ * }
+ * + *

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 and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * JobsSettings jobsSettings = JobsSettings.newHttpJsonBuilder().build();
+ * JobsClient jobsClient = JobsClient.create(jobsSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class JobsClient implements BackgroundResource { + private final JobsSettings settings; + private final JobsStub stub; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; + + /** Constructs an instance of JobsClient with default settings. */ + public static final JobsClient create() throws IOException { + return create(JobsSettings.newBuilder().build()); + } + + /** + * Constructs an instance of JobsClient, using the given settings. The channels are created based + * on the settings passed in, or defaults for any settings that are not set. + */ + public static final JobsClient create(JobsSettings settings) throws IOException { + return new JobsClient(settings); + } + + /** + * Constructs an instance of JobsClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(JobsSettings). + */ + public static final JobsClient create(JobsStub stub) { + return new JobsClient(stub); + } + + /** + * Constructs an instance of JobsClient, 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 JobsClient(JobsSettings settings) throws IOException { + this.settings = settings; + this.stub = ((JobsStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + protected JobsClient(JobsStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + public final JobsSettings getSettings() { + return settings; + } + + public JobsStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + 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. + */ + @BetaApi + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Job job = Job.newBuilder().build();
+   *   String jobId = "jobId101296568";
+   *   Job response = jobsClient.createJobAsync(parent, job, jobId).get();
+   * }
+   * }
+ * + * @param parent Required. The location and project in which this Job should be created. Format: + * projects/{project}/locations/{location} + * @param job Required. The Job instance to create. + * @param jobId Required. The unique identifier for the Job. The name of the job becomes + * {parent}/jobs/{job_id}. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createJobAsync( + LocationName parent, Job job, String jobId) { + CreateJobRequest request = + CreateJobRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setJob(job) + .setJobId(jobId) + .build(); + return createJobAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   Job job = Job.newBuilder().build();
+   *   String jobId = "jobId101296568";
+   *   Job response = jobsClient.createJobAsync(parent, job, jobId).get();
+   * }
+   * }
+ * + * @param parent Required. The location and project in which this Job should be created. Format: + * projects/{project}/locations/{location} + * @param job Required. The Job instance to create. + * @param jobId Required. The unique identifier for the Job. The name of the job becomes + * {parent}/jobs/{job_id}. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createJobAsync(String parent, Job job, String jobId) { + CreateJobRequest request = + CreateJobRequest.newBuilder().setParent(parent).setJob(job).setJobId(jobId).build(); + return createJobAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   CreateJobRequest request =
+   *       CreateJobRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setJob(Job.newBuilder().build())
+   *           .setJobId("jobId101296568")
+   *           .setValidateOnly(true)
+   *           .build();
+   *   Job response = jobsClient.createJobAsync(request).get();
+   * }
+   * }
+ * + * @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 OperationFuture createJobAsync(CreateJobRequest request) { + return createJobOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   CreateJobRequest request =
+   *       CreateJobRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setJob(Job.newBuilder().build())
+   *           .setJobId("jobId101296568")
+   *           .setValidateOnly(true)
+   *           .build();
+   *   OperationFuture future =
+   *       jobsClient.createJobOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable createJobOperationCallable() { + return stub.createJobOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   CreateJobRequest request =
+   *       CreateJobRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setJob(Job.newBuilder().build())
+   *           .setJobId("jobId101296568")
+   *           .setValidateOnly(true)
+   *           .build();
+   *   ApiFuture future = jobsClient.createJobCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable createJobCallable() { + return stub.createJobCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+   *   Job response = jobsClient.getJob(name);
+   * }
+   * }
+ * + * @param name Required. The full name of the Job. Format: + * projects/{project}/locations/{location}/jobs/{job} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Job getJob(JobName name) { + GetJobRequest request = + GetJobRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getJob(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   Job response = jobsClient.getJob(name);
+   * }
+   * }
+ * + * @param name Required. The full name of the Job. Format: + * projects/{project}/locations/{location}/jobs/{job} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Job getJob(String name) { + GetJobRequest request = GetJobRequest.newBuilder().setName(name).build(); + return getJob(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   GetJobRequest request =
+   *       GetJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   Job response = jobsClient.getJob(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Job getJob(GetJobRequest request) { + return getJobCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   GetJobRequest request =
+   *       GetJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .build();
+   *   ApiFuture future = jobsClient.getJobCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getJobCallable() { + return stub.getJobCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Jobs. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (Job element : jobsClient.listJobs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The location and project to list resources on. Format: + * projects/{project}/locations/{location} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListJobsPagedResponse listJobs(LocationName parent) { + ListJobsRequest request = + ListJobsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); + return listJobs(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Jobs. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   for (Job element : jobsClient.listJobs(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The location and project to list resources on. Format: + * projects/{project}/locations/{location} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListJobsPagedResponse listJobs(String parent) { + ListJobsRequest request = ListJobsRequest.newBuilder().setParent(parent).build(); + return listJobs(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Jobs. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   ListJobsRequest request =
+   *       ListJobsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   for (Job element : jobsClient.listJobs(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @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 ListJobsPagedResponse listJobs(ListJobsRequest request) { + return listJobsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Jobs. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   ListJobsRequest request =
+   *       ListJobsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   ApiFuture future = jobsClient.listJobsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Job element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listJobsPagedCallable() { + return stub.listJobsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Jobs. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   ListJobsRequest request =
+   *       ListJobsRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   while (true) {
+   *     ListJobsResponse response = jobsClient.listJobsCallable().call(request);
+   *     for (Job element : response.getJobsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listJobsCallable() { + return stub.listJobsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   Job job = Job.newBuilder().build();
+   *   Job response = jobsClient.updateJobAsync(job).get();
+   * }
+   * }
+ * + * @param job Required. The Job to be updated. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture updateJobAsync(Job job) { + UpdateJobRequest request = UpdateJobRequest.newBuilder().setJob(job).build(); + return updateJobAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   UpdateJobRequest request =
+   *       UpdateJobRequest.newBuilder()
+   *           .setJob(Job.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .setAllowMissing(true)
+   *           .build();
+   *   Job response = jobsClient.updateJobAsync(request).get();
+   * }
+   * }
+ * + * @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 OperationFuture updateJobAsync(UpdateJobRequest request) { + return updateJobOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   UpdateJobRequest request =
+   *       UpdateJobRequest.newBuilder()
+   *           .setJob(Job.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .setAllowMissing(true)
+   *           .build();
+   *   OperationFuture future =
+   *       jobsClient.updateJobOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable updateJobOperationCallable() { + return stub.updateJobOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   UpdateJobRequest request =
+   *       UpdateJobRequest.newBuilder()
+   *           .setJob(Job.newBuilder().build())
+   *           .setValidateOnly(true)
+   *           .setAllowMissing(true)
+   *           .build();
+   *   ApiFuture future = jobsClient.updateJobCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable updateJobCallable() { + return stub.updateJobCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+   *   Job response = jobsClient.deleteJobAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The full name of the Job. Format: + * projects/{project}/locations/{location}/jobs/{job} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteJobAsync(JobName name) { + DeleteJobRequest request = + DeleteJobRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return deleteJobAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   Job response = jobsClient.deleteJobAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The full name of the Job. Format: + * projects/{project}/locations/{location}/jobs/{job} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteJobAsync(String name) { + DeleteJobRequest request = DeleteJobRequest.newBuilder().setName(name).build(); + return deleteJobAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   DeleteJobRequest request =
+   *       DeleteJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   Job response = jobsClient.deleteJobAsync(request).get();
+   * }
+   * }
+ * + * @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 OperationFuture deleteJobAsync(DeleteJobRequest request) { + return deleteJobOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   DeleteJobRequest request =
+   *       DeleteJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   OperationFuture future =
+   *       jobsClient.deleteJobOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Job response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable deleteJobOperationCallable() { + return stub.deleteJobOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   DeleteJobRequest request =
+   *       DeleteJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   ApiFuture future = jobsClient.deleteJobCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deleteJobCallable() { + return stub.deleteJobCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Triggers creation of a new Execution of this Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+   *   Execution response = jobsClient.runJobAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The full name of the Job. Format: + * projects/{project}/locations/{location}/jobs/{job} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture runJobAsync(JobName name) { + RunJobRequest request = + RunJobRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return runJobAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Triggers creation of a new Execution of this Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+   *   Execution response = jobsClient.runJobAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The full name of the Job. Format: + * projects/{project}/locations/{location}/jobs/{job} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture runJobAsync(String name) { + RunJobRequest request = RunJobRequest.newBuilder().setName(name).build(); + return runJobAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Triggers creation of a new Execution of this Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   RunJobRequest request =
+   *       RunJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   Execution response = jobsClient.runJobAsync(request).get();
+   * }
+   * }
+ * + * @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 OperationFuture runJobAsync(RunJobRequest request) { + return runJobOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Triggers creation of a new Execution of this Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   RunJobRequest request =
+   *       RunJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   OperationFuture future =
+   *       jobsClient.runJobOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Execution response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable runJobOperationCallable() { + return stub.runJobOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Triggers creation of a new Execution of this Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   RunJobRequest request =
+   *       RunJobRequest.newBuilder()
+   *           .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setValidateOnly(true)
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   ApiFuture future = jobsClient.runJobCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable runJobCallable() { + return stub.runJobCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Get the IAM Access Control policy currently in effect for the given Job. This result does not + * include any inherited policies. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   Policy response = jobsClient.getIamPolicy(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getIamPolicy(GetIamPolicyRequest request) { + return getIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Get the IAM Access Control policy currently in effect for the given Job. This result does not + * include any inherited policies. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = jobsClient.getIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getIamPolicyCallable() { + return stub.getIamPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sets the IAM Access control policy for the specified Job. Overwrites any existing policy. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Policy response = jobsClient.setIamPolicy(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy setIamPolicy(SetIamPolicyRequest request) { + return setIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sets the IAM Access control policy for the specified Job. Overwrites any existing policy. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = jobsClient.setIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable setIamPolicyCallable() { + return stub.setIamPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns permissions that a caller has on the specified Project. + * + *

There are no permissions required for making this API call. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   TestIamPermissionsResponse response = jobsClient.testIamPermissions(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { + return testIamPermissionsCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns permissions that a caller has on the specified Project. + * + *

There are no permissions required for making this API call. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (JobsClient jobsClient = JobsClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   ApiFuture future =
+   *       jobsClient.testIamPermissionsCallable().futureCall(request);
+   *   // Do something.
+   *   TestIamPermissionsResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + testIamPermissionsCallable() { + return stub.testIamPermissionsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListJobsPagedResponse + extends AbstractPagedListResponse< + ListJobsRequest, ListJobsResponse, Job, ListJobsPage, ListJobsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListJobsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, input -> new ListJobsPagedResponse(input), MoreExecutors.directExecutor()); + } + + private ListJobsPagedResponse(ListJobsPage page) { + super(page, ListJobsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListJobsPage + extends AbstractPage { + + private ListJobsPage( + PageContext context, ListJobsResponse response) { + super(context, response); + } + + private static ListJobsPage createEmptyPage() { + return new ListJobsPage(null, null); + } + + @Override + protected ListJobsPage createPage( + PageContext context, ListJobsResponse response) { + return new ListJobsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListJobsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListJobsRequest, ListJobsResponse, Job, ListJobsPage, ListJobsFixedSizeCollection> { + + private ListJobsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListJobsFixedSizeCollection createEmptyCollection() { + return new ListJobsFixedSizeCollection(null, 0); + } + + @Override + protected ListJobsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListJobsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/JobsSettings.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/JobsSettings.java new file mode 100644 index 000000000000..78e72c47639c --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/JobsSettings.java @@ -0,0 +1,335 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import static com.google.cloud.run.v2.JobsClient.ListJobsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +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; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.run.v2.stub.JobsStubSettings; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link JobsClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (run.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getJob to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * JobsSettings.Builder jobsSettingsBuilder = JobsSettings.newBuilder();
+ * jobsSettingsBuilder
+ *     .getJobSettings()
+ *     .setRetrySettings(
+ *         jobsSettingsBuilder.getJobSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * JobsSettings jobsSettings = jobsSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class JobsSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to createJob. */ + public UnaryCallSettings createJobSettings() { + return ((JobsStubSettings) getStubSettings()).createJobSettings(); + } + + /** Returns the object with the settings used for calls to createJob. */ + public OperationCallSettings createJobOperationSettings() { + return ((JobsStubSettings) getStubSettings()).createJobOperationSettings(); + } + + /** Returns the object with the settings used for calls to getJob. */ + public UnaryCallSettings getJobSettings() { + return ((JobsStubSettings) getStubSettings()).getJobSettings(); + } + + /** Returns the object with the settings used for calls to listJobs. */ + public PagedCallSettings + listJobsSettings() { + return ((JobsStubSettings) getStubSettings()).listJobsSettings(); + } + + /** Returns the object with the settings used for calls to updateJob. */ + public UnaryCallSettings updateJobSettings() { + return ((JobsStubSettings) getStubSettings()).updateJobSettings(); + } + + /** Returns the object with the settings used for calls to updateJob. */ + public OperationCallSettings updateJobOperationSettings() { + return ((JobsStubSettings) getStubSettings()).updateJobOperationSettings(); + } + + /** Returns the object with the settings used for calls to deleteJob. */ + public UnaryCallSettings deleteJobSettings() { + return ((JobsStubSettings) getStubSettings()).deleteJobSettings(); + } + + /** Returns the object with the settings used for calls to deleteJob. */ + public OperationCallSettings deleteJobOperationSettings() { + return ((JobsStubSettings) getStubSettings()).deleteJobOperationSettings(); + } + + /** Returns the object with the settings used for calls to runJob. */ + public UnaryCallSettings runJobSettings() { + return ((JobsStubSettings) getStubSettings()).runJobSettings(); + } + + /** Returns the object with the settings used for calls to runJob. */ + public OperationCallSettings runJobOperationSettings() { + return ((JobsStubSettings) getStubSettings()).runJobOperationSettings(); + } + + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return ((JobsStubSettings) getStubSettings()).getIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return ((JobsStubSettings) getStubSettings()).setIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return ((JobsStubSettings) getStubSettings()).testIamPermissionsSettings(); + } + + public static final JobsSettings create(JobsStubSettings stub) throws IOException { + return new JobsSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return JobsStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return JobsStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return JobsStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return JobsStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return JobsStubSettings.defaultGrpcTransportProviderBuilder(); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return JobsStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return JobsStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return JobsStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** 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); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected JobsSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for JobsSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(JobsStubSettings.newBuilder(clientContext)); + } + + protected Builder(JobsSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(JobsStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(JobsStubSettings.newBuilder()); + } + + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(JobsStubSettings.newHttpJsonBuilder()); + } + + public JobsStubSettings.Builder getStubSettingsBuilder() { + return ((JobsStubSettings.Builder) getStubSettings()); + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to createJob. */ + public UnaryCallSettings.Builder createJobSettings() { + return getStubSettingsBuilder().createJobSettings(); + } + + /** Returns the builder for the settings used for calls to createJob. */ + public OperationCallSettings.Builder createJobOperationSettings() { + return getStubSettingsBuilder().createJobOperationSettings(); + } + + /** Returns the builder for the settings used for calls to getJob. */ + public UnaryCallSettings.Builder getJobSettings() { + return getStubSettingsBuilder().getJobSettings(); + } + + /** Returns the builder for the settings used for calls to listJobs. */ + public PagedCallSettings.Builder + listJobsSettings() { + return getStubSettingsBuilder().listJobsSettings(); + } + + /** Returns the builder for the settings used for calls to updateJob. */ + public UnaryCallSettings.Builder updateJobSettings() { + return getStubSettingsBuilder().updateJobSettings(); + } + + /** Returns the builder for the settings used for calls to updateJob. */ + public OperationCallSettings.Builder updateJobOperationSettings() { + return getStubSettingsBuilder().updateJobOperationSettings(); + } + + /** Returns the builder for the settings used for calls to deleteJob. */ + public UnaryCallSettings.Builder deleteJobSettings() { + return getStubSettingsBuilder().deleteJobSettings(); + } + + /** Returns the builder for the settings used for calls to deleteJob. */ + public OperationCallSettings.Builder deleteJobOperationSettings() { + return getStubSettingsBuilder().deleteJobOperationSettings(); + } + + /** Returns the builder for the settings used for calls to runJob. */ + public UnaryCallSettings.Builder runJobSettings() { + return getStubSettingsBuilder().runJobSettings(); + } + + /** Returns the builder for the settings used for calls to runJob. */ + public OperationCallSettings.Builder + runJobOperationSettings() { + return getStubSettingsBuilder().runJobOperationSettings(); + } + + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getStubSettingsBuilder().getIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return getStubSettingsBuilder().setIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return getStubSettingsBuilder().testIamPermissionsSettings(); + } + + @Override + public JobsSettings build() throws IOException { + return new JobsSettings(this); + } + } +} diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/RevisionsClient.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/RevisionsClient.java index 26928023510d..bc172a37fa1a 100644 --- a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/RevisionsClient.java +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/RevisionsClient.java @@ -313,7 +313,7 @@ public final UnaryCallable getRevisionCallable() { // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * List Revisions from a given Service, or from a given location. + * Lists Revisions from a given Service, or from a given location. * *

Sample code: * @@ -346,7 +346,7 @@ public final ListRevisionsPagedResponse listRevisions(ServiceName parent) { // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * List Revisions from a given Service, or from a given location. + * Lists Revisions from a given Service, or from a given location. * *

Sample code: * @@ -376,7 +376,7 @@ public final ListRevisionsPagedResponse listRevisions(String parent) { // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * List Revisions from a given Service, or from a given location. + * Lists Revisions from a given Service, or from a given location. * *

Sample code: * @@ -409,7 +409,7 @@ public final ListRevisionsPagedResponse listRevisions(ListRevisionsRequest reque // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * List Revisions from a given Service, or from a given location. + * Lists Revisions from a given Service, or from a given location. * *

Sample code: * @@ -442,7 +442,7 @@ public final ListRevisionsPagedResponse listRevisions(ListRevisionsRequest reque // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * List Revisions from a given Service, or from a given location. + * Lists Revisions from a given Service, or from a given location. * *

Sample code: * @@ -481,7 +481,7 @@ public final UnaryCallable listRevi // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Delete a Revision. + * Deletes a Revision. * *

Sample code: * @@ -509,7 +509,7 @@ public final OperationFuture deleteRevisionAsync(RevisionNam // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Delete a Revision. + * Deletes a Revision. * *

Sample code: * @@ -537,7 +537,7 @@ public final OperationFuture deleteRevisionAsync(String name // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Delete a Revision. + * Deletes a Revision. * *

Sample code: * @@ -569,7 +569,7 @@ public final OperationFuture deleteRevisionAsync( // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Delete a Revision. + * Deletes a Revision. * *

Sample code: * @@ -601,7 +601,7 @@ public final OperationFuture deleteRevisionAsync( // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Delete a Revision. + * Deletes a Revision. * *

Sample code: * diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/ServicesClient.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/ServicesClient.java index 47dd97ad1937..9ecd1a1bc37f 100644 --- a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/ServicesClient.java +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/ServicesClient.java @@ -223,8 +223,9 @@ public final OperationsClient getHttpJsonOperationsClient() { * } * } * - * @param parent The location and project in which this service should be created. Format: - * projects/{project}/locations/{location} Only lowercase characters, digits, and hyphens. + * @param parent Required. The location and project in which this service should be created. + * Format: projects/{project}/locations/{location} Only lowercase characters, digits, and + * hyphens. * @param service Required. The Service instance to create. * @param serviceId Required. The unique identifier for the Service. It must begin with letter, * and may not end with hyphen; must contain fewer than 50 characters. The name of the service @@ -262,8 +263,9 @@ public final OperationFuture createServiceAsync( * } * } * - * @param parent The location and project in which this service should be created. Format: - * projects/{project}/locations/{location} Only lowercase characters, digits, and hyphens. + * @param parent Required. The location and project in which this service should be created. + * Format: projects/{project}/locations/{location} Only lowercase characters, digits, and + * hyphens. * @param service Required. The Service instance to create. * @param serviceId Required. The unique identifier for the Service. It must begin with letter, * and may not end with hyphen; must contain fewer than 50 characters. The name of the service @@ -486,7 +488,7 @@ public final UnaryCallable getServiceCallable() { // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * List Services. + * Lists Services. * *

Sample code: * @@ -519,7 +521,7 @@ public final ListServicesPagedResponse listServices(LocationName parent) { // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * List Services. + * Lists Services. * *

Sample code: * @@ -549,7 +551,7 @@ public final ListServicesPagedResponse listServices(String parent) { // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * List Services. + * Lists Services. * *

Sample code: * @@ -582,7 +584,7 @@ public final ListServicesPagedResponse listServices(ListServicesRequest request) // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * List Services. + * Lists Services. * *

Sample code: * @@ -615,7 +617,7 @@ public final ListServicesPagedResponse listServices(ListServicesRequest request) // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * List Services. + * Lists Services. * *

Sample code: * @@ -920,7 +922,7 @@ public final UnaryCallable deleteServiceCallabl // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Get the IAM Access Control policy currently in effect for the given Cloud Run Service. This + * Gets the IAM Access Control policy currently in effect for the given Cloud Run Service. This * result does not include any inherited policies. * *

Sample code: @@ -950,7 +952,7 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Get the IAM Access Control policy currently in effect for the given Cloud Run Service. This + * Gets the IAM Access Control policy currently in effect for the given Cloud Run Service. This * result does not include any inherited policies. * *

Sample code: diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/TasksClient.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/TasksClient.java new file mode 100644 index 000000000000..afe232919c85 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/TasksClient.java @@ -0,0 +1,550 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.run.v2.stub.TasksStub; +import com.google.cloud.run.v2.stub.TasksStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Cloud Run Task Control Plane API. + * + *

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

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (TasksClient tasksClient = TasksClient.create()) {
+ *   TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]");
+ *   Task response = tasksClient.getTask(name);
+ * }
+ * }
+ * + *

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

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of TasksSettings to create(). For + * example: + * + *

To customize credentials: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * TasksSettings tasksSettings =
+ *     TasksSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * TasksClient tasksClient = TasksClient.create(tasksSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * TasksSettings tasksSettings = TasksSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * TasksClient tasksClient = TasksClient.create(tasksSettings);
+ * }
+ * + *

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 and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * TasksSettings tasksSettings = TasksSettings.newHttpJsonBuilder().build();
+ * TasksClient tasksClient = TasksClient.create(tasksSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class TasksClient implements BackgroundResource { + private final TasksSettings settings; + private final TasksStub stub; + + /** Constructs an instance of TasksClient with default settings. */ + public static final TasksClient create() throws IOException { + return create(TasksSettings.newBuilder().build()); + } + + /** + * Constructs an instance of TasksClient, using the given settings. The channels are created based + * on the settings passed in, or defaults for any settings that are not set. + */ + public static final TasksClient create(TasksSettings settings) throws IOException { + return new TasksClient(settings); + } + + /** + * Constructs an instance of TasksClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(TasksSettings). + */ + public static final TasksClient create(TasksStub stub) { + return new TasksClient(stub); + } + + /** + * Constructs an instance of TasksClient, 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 TasksClient(TasksSettings settings) throws IOException { + this.settings = settings; + this.stub = ((TasksStubSettings) settings.getStubSettings()).createStub(); + } + + protected TasksClient(TasksStub stub) { + this.settings = null; + this.stub = stub; + } + + public final TasksSettings getSettings() { + return settings; + } + + public TasksStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a Task. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (TasksClient tasksClient = TasksClient.create()) {
+   *   TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]");
+   *   Task response = tasksClient.getTask(name);
+   * }
+   * }
+ * + * @param name Required. The full name of the Task. Format: + * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Task getTask(TaskName name) { + GetTaskRequest request = + GetTaskRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getTask(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a Task. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (TasksClient tasksClient = TasksClient.create()) {
+   *   String name =
+   *       TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]").toString();
+   *   Task response = tasksClient.getTask(name);
+   * }
+   * }
+ * + * @param name Required. The full name of the Task. Format: + * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Task getTask(String name) { + GetTaskRequest request = GetTaskRequest.newBuilder().setName(name).build(); + return getTask(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a Task. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (TasksClient tasksClient = TasksClient.create()) {
+   *   GetTaskRequest request =
+   *       GetTaskRequest.newBuilder()
+   *           .setName(
+   *               TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]")
+   *                   .toString())
+   *           .build();
+   *   Task response = tasksClient.getTask(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Task getTask(GetTaskRequest request) { + return getTaskCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a Task. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (TasksClient tasksClient = TasksClient.create()) {
+   *   GetTaskRequest request =
+   *       GetTaskRequest.newBuilder()
+   *           .setName(
+   *               TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future = tasksClient.getTaskCallable().futureCall(request);
+   *   // Do something.
+   *   Task response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getTaskCallable() { + return stub.getTaskCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Tasks from an Execution of a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (TasksClient tasksClient = TasksClient.create()) {
+   *   ExecutionName parent = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]");
+   *   for (Task element : tasksClient.listTasks(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The Execution from which the Tasks should be listed. To list all Tasks + * across Executions of a Job, use "-" instead of Execution name. To list all Tasks across + * Jobs, use "-" instead of Job name. Format: + * projects/{project}/locations/{location}/jobs/{job}/executions/{execution} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListTasksPagedResponse listTasks(ExecutionName parent) { + ListTasksRequest request = + ListTasksRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); + return listTasks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Tasks from an Execution of a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (TasksClient tasksClient = TasksClient.create()) {
+   *   String parent =
+   *       ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString();
+   *   for (Task element : tasksClient.listTasks(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The Execution from which the Tasks should be listed. To list all Tasks + * across Executions of a Job, use "-" instead of Execution name. To list all Tasks across + * Jobs, use "-" instead of Job name. Format: + * projects/{project}/locations/{location}/jobs/{job}/executions/{execution} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListTasksPagedResponse listTasks(String parent) { + ListTasksRequest request = ListTasksRequest.newBuilder().setParent(parent).build(); + return listTasks(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Tasks from an Execution of a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (TasksClient tasksClient = TasksClient.create()) {
+   *   ListTasksRequest request =
+   *       ListTasksRequest.newBuilder()
+   *           .setParent(
+   *               ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   for (Task element : tasksClient.listTasks(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @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 ListTasksPagedResponse listTasks(ListTasksRequest request) { + return listTasksPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Tasks from an Execution of a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (TasksClient tasksClient = TasksClient.create()) {
+   *   ListTasksRequest request =
+   *       ListTasksRequest.newBuilder()
+   *           .setParent(
+   *               ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   ApiFuture future = tasksClient.listTasksPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Task element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listTasksPagedCallable() { + return stub.listTasksPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Tasks from an Execution of a Job. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (TasksClient tasksClient = TasksClient.create()) {
+   *   ListTasksRequest request =
+   *       ListTasksRequest.newBuilder()
+   *           .setParent(
+   *               ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   while (true) {
+   *     ListTasksResponse response = tasksClient.listTasksCallable().call(request);
+   *     for (Task element : response.getTasksList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listTasksCallable() { + return stub.listTasksCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListTasksPagedResponse + extends AbstractPagedListResponse< + ListTasksRequest, ListTasksResponse, Task, ListTasksPage, ListTasksFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListTasksPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, input -> new ListTasksPagedResponse(input), MoreExecutors.directExecutor()); + } + + private ListTasksPagedResponse(ListTasksPage page) { + super(page, ListTasksFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListTasksPage + extends AbstractPage { + + private ListTasksPage( + PageContext context, + ListTasksResponse response) { + super(context, response); + } + + private static ListTasksPage createEmptyPage() { + return new ListTasksPage(null, null); + } + + @Override + protected ListTasksPage createPage( + PageContext context, + ListTasksResponse response) { + return new ListTasksPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListTasksFixedSizeCollection + extends AbstractFixedSizeCollection< + ListTasksRequest, ListTasksResponse, Task, ListTasksPage, ListTasksFixedSizeCollection> { + + private ListTasksFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListTasksFixedSizeCollection createEmptyCollection() { + return new ListTasksFixedSizeCollection(null, 0); + } + + @Override + protected ListTasksFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListTasksFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/TasksSettings.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/TasksSettings.java new file mode 100644 index 000000000000..85e40fd5afdb --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/TasksSettings.java @@ -0,0 +1,215 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import static com.google.cloud.run.v2.TasksClient.ListTasksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +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; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.run.v2.stub.TasksStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link TasksClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (run.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getTask to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * TasksSettings.Builder tasksSettingsBuilder = TasksSettings.newBuilder();
+ * tasksSettingsBuilder
+ *     .getTaskSettings()
+ *     .setRetrySettings(
+ *         tasksSettingsBuilder.getTaskSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * TasksSettings tasksSettings = tasksSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class TasksSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to getTask. */ + public UnaryCallSettings getTaskSettings() { + return ((TasksStubSettings) getStubSettings()).getTaskSettings(); + } + + /** Returns the object with the settings used for calls to listTasks. */ + public PagedCallSettings + listTasksSettings() { + return ((TasksStubSettings) getStubSettings()).listTasksSettings(); + } + + public static final TasksSettings create(TasksStubSettings stub) throws IOException { + return new TasksSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return TasksStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return TasksStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return TasksStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return TasksStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return TasksStubSettings.defaultGrpcTransportProviderBuilder(); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return TasksStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return TasksStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return TasksStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** 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); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TasksSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for TasksSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(TasksStubSettings.newBuilder(clientContext)); + } + + protected Builder(TasksSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(TasksStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(TasksStubSettings.newBuilder()); + } + + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(TasksStubSettings.newHttpJsonBuilder()); + } + + public TasksStubSettings.Builder getStubSettingsBuilder() { + return ((TasksStubSettings.Builder) getStubSettings()); + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to getTask. */ + public UnaryCallSettings.Builder getTaskSettings() { + return getStubSettingsBuilder().getTaskSettings(); + } + + /** Returns the builder for the settings used for calls to listTasks. */ + public PagedCallSettings.Builder + listTasksSettings() { + return getStubSettingsBuilder().listTasksSettings(); + } + + @Override + public TasksSettings build() throws IOException { + return new TasksSettings(this); + } + } +} diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/gapic_metadata.json b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/gapic_metadata.json index 0e6120fb0174..77a417f411b8 100644 --- a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/gapic_metadata.json +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/gapic_metadata.json @@ -5,6 +5,60 @@ "protoPackage": "google.cloud.run.v2", "libraryPackage": "com.google.cloud.run.v2", "services": { + "Executions": { + "clients": { + "grpc": { + "libraryClient": "ExecutionsClient", + "rpcs": { + "DeleteExecution": { + "methods": ["deleteExecutionAsync", "deleteExecutionAsync", "deleteExecutionAsync", "deleteExecutionOperationCallable", "deleteExecutionCallable"] + }, + "GetExecution": { + "methods": ["getExecution", "getExecution", "getExecution", "getExecutionCallable"] + }, + "ListExecutions": { + "methods": ["listExecutions", "listExecutions", "listExecutions", "listExecutionsPagedCallable", "listExecutionsCallable"] + } + } + } + } + }, + "Jobs": { + "clients": { + "grpc": { + "libraryClient": "JobsClient", + "rpcs": { + "CreateJob": { + "methods": ["createJobAsync", "createJobAsync", "createJobAsync", "createJobOperationCallable", "createJobCallable"] + }, + "DeleteJob": { + "methods": ["deleteJobAsync", "deleteJobAsync", "deleteJobAsync", "deleteJobOperationCallable", "deleteJobCallable"] + }, + "GetIamPolicy": { + "methods": ["getIamPolicy", "getIamPolicyCallable"] + }, + "GetJob": { + "methods": ["getJob", "getJob", "getJob", "getJobCallable"] + }, + "ListJobs": { + "methods": ["listJobs", "listJobs", "listJobs", "listJobsPagedCallable", "listJobsCallable"] + }, + "RunJob": { + "methods": ["runJobAsync", "runJobAsync", "runJobAsync", "runJobOperationCallable", "runJobCallable"] + }, + "SetIamPolicy": { + "methods": ["setIamPolicy", "setIamPolicyCallable"] + }, + "TestIamPermissions": { + "methods": ["testIamPermissions", "testIamPermissionsCallable"] + }, + "UpdateJob": { + "methods": ["updateJobAsync", "updateJobAsync", "updateJobOperationCallable", "updateJobCallable"] + } + } + } + } + }, "Revisions": { "clients": { "grpc": { @@ -55,6 +109,21 @@ } } } + }, + "Tasks": { + "clients": { + "grpc": { + "libraryClient": "TasksClient", + "rpcs": { + "GetTask": { + "methods": ["getTask", "getTask", "getTask", "getTaskCallable"] + }, + "ListTasks": { + "methods": ["listTasks", "listTasks", "listTasks", "listTasksPagedCallable", "listTasksCallable"] + } + } + } + } } } } \ No newline at end of file diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/package-info.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/package-info.java index 0e79f8677112..f7e5cb3862c4 100644 --- a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/package-info.java +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/package-info.java @@ -19,6 +19,42 @@ * *

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

======================= ExecutionsClient ======================= + * + *

Service Description: Cloud Run Execution Control Plane API. + * + *

Sample for ExecutionsClient: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+ *   ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]");
+ *   Execution response = executionsClient.getExecution(name);
+ * }
+ * }
+ * + *

======================= JobsClient ======================= + * + *

Service Description: Cloud Run Job Control Plane API. + * + *

Sample for JobsClient: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (JobsClient jobsClient = JobsClient.create()) {
+ *   JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+ *   Job response = jobsClient.getJob(name);
+ * }
+ * }
+ * *

======================= RevisionsClient ======================= * *

Service Description: Cloud Run Revision Control Plane API. @@ -54,6 +90,24 @@ * Service response = servicesClient.getService(name); * } * } + * + *

======================= TasksClient ======================= + * + *

Service Description: Cloud Run Task Control Plane API. + * + *

Sample for TasksClient: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (TasksClient tasksClient = TasksClient.create()) {
+ *   TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]");
+ *   Task response = tasksClient.getTask(name);
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.cloud.run.v2; diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/ExecutionsStub.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/ExecutionsStub.java new file mode 100644 index 000000000000..842b9d7e80b9 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/ExecutionsStub.java @@ -0,0 +1,74 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2.stub; + +import static com.google.cloud.run.v2.ExecutionsClient.ListExecutionsPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.run.v2.DeleteExecutionRequest; +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.GetExecutionRequest; +import com.google.cloud.run.v2.ListExecutionsRequest; +import com.google.cloud.run.v2.ListExecutionsResponse; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the Executions service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class ExecutionsStub implements BackgroundResource { + + public OperationsStub getOperationsStub() { + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; + } + + public UnaryCallable getExecutionCallable() { + throw new UnsupportedOperationException("Not implemented: getExecutionCallable()"); + } + + public UnaryCallable + listExecutionsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listExecutionsPagedCallable()"); + } + + public UnaryCallable listExecutionsCallable() { + throw new UnsupportedOperationException("Not implemented: listExecutionsCallable()"); + } + + public OperationCallable + deleteExecutionOperationCallable() { + throw new UnsupportedOperationException("Not implemented: deleteExecutionOperationCallable()"); + } + + public UnaryCallable deleteExecutionCallable() { + throw new UnsupportedOperationException("Not implemented: deleteExecutionCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/ExecutionsStubSettings.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/ExecutionsStubSettings.java new file mode 100644 index 000000000000..4f9244bc1201 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/ExecutionsStubSettings.java @@ -0,0 +1,477 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2.stub; + +import static com.google.cloud.run.v2.ExecutionsClient.ListExecutionsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +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.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; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.run.v2.DeleteExecutionRequest; +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.GetExecutionRequest; +import com.google.cloud.run.v2.ListExecutionsRequest; +import com.google.cloud.run.v2.ListExecutionsResponse; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link ExecutionsStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (run.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getExecution to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * ExecutionsStubSettings.Builder executionsSettingsBuilder = ExecutionsStubSettings.newBuilder();
+ * executionsSettingsBuilder
+ *     .getExecutionSettings()
+ *     .setRetrySettings(
+ *         executionsSettingsBuilder.getExecutionSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * ExecutionsStubSettings executionsSettings = executionsSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class ExecutionsStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings getExecutionSettings; + private final PagedCallSettings< + ListExecutionsRequest, ListExecutionsResponse, ListExecutionsPagedResponse> + listExecutionsSettings; + private final UnaryCallSettings deleteExecutionSettings; + private final OperationCallSettings + deleteExecutionOperationSettings; + + private static final PagedListDescriptor + LIST_EXECUTIONS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListExecutionsRequest injectToken(ListExecutionsRequest payload, String token) { + return ListExecutionsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListExecutionsRequest injectPageSize( + ListExecutionsRequest payload, int pageSize) { + return ListExecutionsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListExecutionsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListExecutionsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListExecutionsResponse payload) { + return payload.getExecutionsList() == null + ? ImmutableList.of() + : payload.getExecutionsList(); + } + }; + + private static final PagedListResponseFactory< + ListExecutionsRequest, ListExecutionsResponse, ListExecutionsPagedResponse> + LIST_EXECUTIONS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListExecutionsRequest, ListExecutionsResponse, ListExecutionsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListExecutionsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_EXECUTIONS_PAGE_STR_DESC, request, context); + return ListExecutionsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to getExecution. */ + public UnaryCallSettings getExecutionSettings() { + return getExecutionSettings; + } + + /** Returns the object with the settings used for calls to listExecutions. */ + public PagedCallSettings< + ListExecutionsRequest, ListExecutionsResponse, ListExecutionsPagedResponse> + listExecutionsSettings() { + return listExecutionsSettings; + } + + /** Returns the object with the settings used for calls to deleteExecution. */ + public UnaryCallSettings deleteExecutionSettings() { + return deleteExecutionSettings; + } + + /** Returns the object with the settings used for calls to deleteExecution. */ + public OperationCallSettings + deleteExecutionOperationSettings() { + return deleteExecutionOperationSettings; + } + + public ExecutionsStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcExecutionsStub.create(this); + } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonExecutionsStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "run.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "run.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** 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 defaultGrpcApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(ExecutionsStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + @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(ExecutionsStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ExecutionsStubSettings.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); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ExecutionsStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + getExecutionSettings = settingsBuilder.getExecutionSettings().build(); + listExecutionsSettings = settingsBuilder.listExecutionsSettings().build(); + deleteExecutionSettings = settingsBuilder.deleteExecutionSettings().build(); + deleteExecutionOperationSettings = settingsBuilder.deleteExecutionOperationSettings().build(); + } + + /** Builder for ExecutionsStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder getExecutionSettings; + private final PagedCallSettings.Builder< + ListExecutionsRequest, ListExecutionsResponse, ListExecutionsPagedResponse> + listExecutionsSettings; + private final UnaryCallSettings.Builder + deleteExecutionSettings; + private final OperationCallSettings.Builder + deleteExecutionOperationSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + getExecutionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listExecutionsSettings = PagedCallSettings.newBuilder(LIST_EXECUTIONS_PAGE_STR_FACT); + deleteExecutionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteExecutionOperationSettings = OperationCallSettings.newBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getExecutionSettings, listExecutionsSettings, deleteExecutionSettings); + initDefaults(this); + } + + protected Builder(ExecutionsStubSettings settings) { + super(settings); + + getExecutionSettings = settings.getExecutionSettings.toBuilder(); + listExecutionsSettings = settings.listExecutionsSettings.toBuilder(); + deleteExecutionSettings = settings.deleteExecutionSettings.toBuilder(); + deleteExecutionOperationSettings = settings.deleteExecutionOperationSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getExecutionSettings, listExecutionsSettings, deleteExecutionSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + 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 + .getExecutionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .listExecutionsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .deleteExecutionSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .deleteExecutionOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Execution.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(Execution.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + return builder; + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to getExecution. */ + public UnaryCallSettings.Builder getExecutionSettings() { + return getExecutionSettings; + } + + /** Returns the builder for the settings used for calls to listExecutions. */ + public PagedCallSettings.Builder< + ListExecutionsRequest, ListExecutionsResponse, ListExecutionsPagedResponse> + listExecutionsSettings() { + return listExecutionsSettings; + } + + /** Returns the builder for the settings used for calls to deleteExecution. */ + public UnaryCallSettings.Builder deleteExecutionSettings() { + return deleteExecutionSettings; + } + + /** Returns the builder for the settings used for calls to deleteExecution. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteExecutionOperationSettings() { + return deleteExecutionOperationSettings; + } + + @Override + public ExecutionsStubSettings build() throws IOException { + return new ExecutionsStubSettings(this); + } + } +} diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcExecutionsCallableFactory.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcExecutionsCallableFactory.java new file mode 100644 index 000000000000..6e81edc5a132 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcExecutionsCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +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.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the Executions service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcExecutionsCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcExecutionsStub.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcExecutionsStub.java new file mode 100644 index 000000000000..31562987f2aa --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcExecutionsStub.java @@ -0,0 +1,251 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2.stub; + +import static com.google.cloud.run.v2.ExecutionsClient.ListExecutionsPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +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.run.v2.DeleteExecutionRequest; +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.GetExecutionRequest; +import com.google.cloud.run.v2.ListExecutionsRequest; +import com.google.cloud.run.v2.ListExecutionsResponse; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.GrpcOperationsStub; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the Executions service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcExecutionsStub extends ExecutionsStub { + private static final MethodDescriptor + getExecutionMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.run.v2.Executions/GetExecution") + .setRequestMarshaller(ProtoUtils.marshaller(GetExecutionRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Execution.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listExecutionsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.run.v2.Executions/ListExecutions") + .setRequestMarshaller( + ProtoUtils.marshaller(ListExecutionsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListExecutionsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + deleteExecutionMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.run.v2.Executions/DeleteExecution") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteExecutionRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private final UnaryCallable getExecutionCallable; + private final UnaryCallable listExecutionsCallable; + private final UnaryCallable + listExecutionsPagedCallable; + private final UnaryCallable deleteExecutionCallable; + private final OperationCallable + deleteExecutionOperationCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcExecutionsStub create(ExecutionsStubSettings settings) + throws IOException { + return new GrpcExecutionsStub(settings, ClientContext.create(settings)); + } + + public static final GrpcExecutionsStub create(ClientContext clientContext) throws IOException { + return new GrpcExecutionsStub(ExecutionsStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcExecutionsStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcExecutionsStub( + ExecutionsStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcExecutionsStub, 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 GrpcExecutionsStub(ExecutionsStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcExecutionsCallableFactory()); + } + + /** + * Constructs an instance of GrpcExecutionsStub, 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 GrpcExecutionsStub( + ExecutionsStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings getExecutionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getExecutionMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings + listExecutionsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listExecutionsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings deleteExecutionTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteExecutionMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + + this.getExecutionCallable = + callableFactory.createUnaryCallable( + getExecutionTransportSettings, settings.getExecutionSettings(), clientContext); + this.listExecutionsCallable = + callableFactory.createUnaryCallable( + listExecutionsTransportSettings, settings.listExecutionsSettings(), clientContext); + this.listExecutionsPagedCallable = + callableFactory.createPagedCallable( + listExecutionsTransportSettings, settings.listExecutionsSettings(), clientContext); + this.deleteExecutionCallable = + callableFactory.createUnaryCallable( + deleteExecutionTransportSettings, settings.deleteExecutionSettings(), clientContext); + this.deleteExecutionOperationCallable = + callableFactory.createOperationCallable( + deleteExecutionTransportSettings, + settings.deleteExecutionOperationSettings(), + clientContext, + operationsStub); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable getExecutionCallable() { + return getExecutionCallable; + } + + @Override + public UnaryCallable listExecutionsCallable() { + return listExecutionsCallable; + } + + @Override + public UnaryCallable + listExecutionsPagedCallable() { + return listExecutionsPagedCallable; + } + + @Override + public UnaryCallable deleteExecutionCallable() { + return deleteExecutionCallable; + } + + @Override + public OperationCallable + deleteExecutionOperationCallable() { + return deleteExecutionOperationCallable; + } + + @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/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcJobsCallableFactory.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcJobsCallableFactory.java new file mode 100644 index 000000000000..7d6644b12c17 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcJobsCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +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.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the Jobs service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcJobsCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcJobsStub.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcJobsStub.java new file mode 100644 index 000000000000..e3a0d323e849 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcJobsStub.java @@ -0,0 +1,452 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2.stub; + +import static com.google.cloud.run.v2.JobsClient.ListJobsPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +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.run.v2.CreateJobRequest; +import com.google.cloud.run.v2.DeleteJobRequest; +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.GetJobRequest; +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.ListJobsRequest; +import com.google.cloud.run.v2.ListJobsResponse; +import com.google.cloud.run.v2.RunJobRequest; +import com.google.cloud.run.v2.UpdateJobRequest; +import com.google.common.collect.ImmutableMap; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.GrpcOperationsStub; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the Jobs service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcJobsStub extends JobsStub { + private static final MethodDescriptor createJobMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.run.v2.Jobs/CreateJob") + .setRequestMarshaller(ProtoUtils.marshaller(CreateJobRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getJobMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.run.v2.Jobs/GetJob") + .setRequestMarshaller(ProtoUtils.marshaller(GetJobRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Job.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listJobsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.run.v2.Jobs/ListJobs") + .setRequestMarshaller(ProtoUtils.marshaller(ListJobsRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(ListJobsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor updateJobMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.run.v2.Jobs/UpdateJob") + .setRequestMarshaller(ProtoUtils.marshaller(UpdateJobRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor deleteJobMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.run.v2.Jobs/DeleteJob") + .setRequestMarshaller(ProtoUtils.marshaller(DeleteJobRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor runJobMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.run.v2.Jobs/RunJob") + .setRequestMarshaller(ProtoUtils.marshaller(RunJobRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.run.v2.Jobs/GetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .build(); + + private static final MethodDescriptor setIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.run.v2.Jobs/SetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + testIamPermissionsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.run.v2.Jobs/TestIamPermissions") + .setRequestMarshaller( + ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) + .build(); + + private final UnaryCallable createJobCallable; + private final OperationCallable createJobOperationCallable; + private final UnaryCallable getJobCallable; + private final UnaryCallable listJobsCallable; + private final UnaryCallable listJobsPagedCallable; + private final UnaryCallable updateJobCallable; + private final OperationCallable updateJobOperationCallable; + private final UnaryCallable deleteJobCallable; + private final OperationCallable deleteJobOperationCallable; + private final UnaryCallable runJobCallable; + private final OperationCallable runJobOperationCallable; + private final UnaryCallable getIamPolicyCallable; + private final UnaryCallable setIamPolicyCallable; + private final UnaryCallable + testIamPermissionsCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcJobsStub create(JobsStubSettings settings) throws IOException { + return new GrpcJobsStub(settings, ClientContext.create(settings)); + } + + public static final GrpcJobsStub create(ClientContext clientContext) throws IOException { + return new GrpcJobsStub(JobsStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcJobsStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcJobsStub(JobsStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcJobsStub, 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 GrpcJobsStub(JobsStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcJobsCallableFactory()); + } + + /** + * Constructs an instance of GrpcJobsStub, 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 GrpcJobsStub( + JobsStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings createJobTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createJobMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings getJobTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getJobMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings listJobsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listJobsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings updateJobTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateJobMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("job.name", String.valueOf(request.getJob().getName())); + return params.build(); + }) + .build(); + GrpcCallSettings deleteJobTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteJobMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings runJobTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(runJobMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getIamPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + }) + .build(); + GrpcCallSettings setIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(setIamPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + }) + .build(); + GrpcCallSettings + testIamPermissionsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(testIamPermissionsMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + }) + .build(); + + this.createJobCallable = + callableFactory.createUnaryCallable( + createJobTransportSettings, settings.createJobSettings(), clientContext); + this.createJobOperationCallable = + callableFactory.createOperationCallable( + createJobTransportSettings, + settings.createJobOperationSettings(), + clientContext, + operationsStub); + this.getJobCallable = + callableFactory.createUnaryCallable( + getJobTransportSettings, settings.getJobSettings(), clientContext); + this.listJobsCallable = + callableFactory.createUnaryCallable( + listJobsTransportSettings, settings.listJobsSettings(), clientContext); + this.listJobsPagedCallable = + callableFactory.createPagedCallable( + listJobsTransportSettings, settings.listJobsSettings(), clientContext); + this.updateJobCallable = + callableFactory.createUnaryCallable( + updateJobTransportSettings, settings.updateJobSettings(), clientContext); + this.updateJobOperationCallable = + callableFactory.createOperationCallable( + updateJobTransportSettings, + settings.updateJobOperationSettings(), + clientContext, + operationsStub); + this.deleteJobCallable = + callableFactory.createUnaryCallable( + deleteJobTransportSettings, settings.deleteJobSettings(), clientContext); + this.deleteJobOperationCallable = + callableFactory.createOperationCallable( + deleteJobTransportSettings, + settings.deleteJobOperationSettings(), + clientContext, + operationsStub); + this.runJobCallable = + callableFactory.createUnaryCallable( + runJobTransportSettings, settings.runJobSettings(), clientContext); + this.runJobOperationCallable = + callableFactory.createOperationCallable( + runJobTransportSettings, + settings.runJobOperationSettings(), + clientContext, + operationsStub); + this.getIamPolicyCallable = + callableFactory.createUnaryCallable( + getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); + this.setIamPolicyCallable = + callableFactory.createUnaryCallable( + setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); + this.testIamPermissionsCallable = + callableFactory.createUnaryCallable( + testIamPermissionsTransportSettings, + settings.testIamPermissionsSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable createJobCallable() { + return createJobCallable; + } + + @Override + public OperationCallable createJobOperationCallable() { + return createJobOperationCallable; + } + + @Override + public UnaryCallable getJobCallable() { + return getJobCallable; + } + + @Override + public UnaryCallable listJobsCallable() { + return listJobsCallable; + } + + @Override + public UnaryCallable listJobsPagedCallable() { + return listJobsPagedCallable; + } + + @Override + public UnaryCallable updateJobCallable() { + return updateJobCallable; + } + + @Override + public OperationCallable updateJobOperationCallable() { + return updateJobOperationCallable; + } + + @Override + public UnaryCallable deleteJobCallable() { + return deleteJobCallable; + } + + @Override + public OperationCallable deleteJobOperationCallable() { + return deleteJobOperationCallable; + } + + @Override + public UnaryCallable runJobCallable() { + return runJobCallable; + } + + @Override + public OperationCallable runJobOperationCallable() { + return runJobOperationCallable; + } + + @Override + public UnaryCallable getIamPolicyCallable() { + return getIamPolicyCallable; + } + + @Override + public UnaryCallable setIamPolicyCallable() { + return setIamPolicyCallable; + } + + @Override + public UnaryCallable + testIamPermissionsCallable() { + return testIamPermissionsCallable; + } + + @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/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcTasksCallableFactory.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcTasksCallableFactory.java new file mode 100644 index 000000000000..d5da80972069 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcTasksCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +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.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the Tasks service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcTasksCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcTasksStub.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcTasksStub.java new file mode 100644 index 000000000000..58512a72ca93 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/GrpcTasksStub.java @@ -0,0 +1,196 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2.stub; + +import static com.google.cloud.run.v2.TasksClient.ListTasksPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.run.v2.GetTaskRequest; +import com.google.cloud.run.v2.ListTasksRequest; +import com.google.cloud.run.v2.ListTasksResponse; +import com.google.cloud.run.v2.Task; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the Tasks service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcTasksStub extends TasksStub { + private static final MethodDescriptor getTaskMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.run.v2.Tasks/GetTask") + .setRequestMarshaller(ProtoUtils.marshaller(GetTaskRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Task.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listTasksMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.run.v2.Tasks/ListTasks") + .setRequestMarshaller(ProtoUtils.marshaller(ListTasksRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(ListTasksResponse.getDefaultInstance())) + .build(); + + private final UnaryCallable getTaskCallable; + private final UnaryCallable listTasksCallable; + private final UnaryCallable listTasksPagedCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcTasksStub create(TasksStubSettings settings) throws IOException { + return new GrpcTasksStub(settings, ClientContext.create(settings)); + } + + public static final GrpcTasksStub create(ClientContext clientContext) throws IOException { + return new GrpcTasksStub(TasksStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcTasksStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcTasksStub( + TasksStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcTasksStub, 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 GrpcTasksStub(TasksStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcTasksCallableFactory()); + } + + /** + * Constructs an instance of GrpcTasksStub, 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 GrpcTasksStub( + TasksStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings getTaskTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getTaskMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings listTasksTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listTasksMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + + this.getTaskCallable = + callableFactory.createUnaryCallable( + getTaskTransportSettings, settings.getTaskSettings(), clientContext); + this.listTasksCallable = + callableFactory.createUnaryCallable( + listTasksTransportSettings, settings.listTasksSettings(), clientContext); + this.listTasksPagedCallable = + callableFactory.createPagedCallable( + listTasksTransportSettings, settings.listTasksSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable getTaskCallable() { + return getTaskCallable; + } + + @Override + public UnaryCallable listTasksCallable() { + return listTasksCallable; + } + + @Override + public UnaryCallable listTasksPagedCallable() { + return listTasksPagedCallable; + } + + @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/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonExecutionsCallableFactory.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonExecutionsCallableFactory.java new file mode 100644 index 000000000000..02b9f0f018ad --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonExecutionsCallableFactory.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.run.v2.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 Executions service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonExecutionsCallableFactory + 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/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonExecutionsStub.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonExecutionsStub.java new file mode 100644 index 000000000000..c53f1957fd51 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonExecutionsStub.java @@ -0,0 +1,340 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2.stub; + +import static com.google.cloud.run.v2.ExecutionsClient.ListExecutionsPagedResponse; + +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.run.v2.DeleteExecutionRequest; +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.GetExecutionRequest; +import com.google.cloud.run.v2.ListExecutionsRequest; +import com.google.cloud.run.v2.ListExecutionsResponse; +import com.google.longrunning.Operation; +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 Executions service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonExecutionsStub extends ExecutionsStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder().add(Execution.getDescriptor()).build(); + + private static final ApiMethodDescriptor + getExecutionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.run.v2.Executions/GetExecution") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/jobs/*/executions/*}", + 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(Execution.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listExecutionsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.run.v2.Executions/ListExecutions") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*/jobs/*}/executions", + 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()); + serializer.putQueryParam( + fields, "showDeleted", request.getShowDeleted()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListExecutionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteExecutionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.run.v2.Executions/DeleteExecution") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/jobs/*/executions/*}", + 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, "etag", request.getEtag()); + serializer.putQueryParam( + fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteExecutionRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private final UnaryCallable getExecutionCallable; + private final UnaryCallable listExecutionsCallable; + private final UnaryCallable + listExecutionsPagedCallable; + private final UnaryCallable deleteExecutionCallable; + private final OperationCallable + deleteExecutionOperationCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonExecutionsStub create(ExecutionsStubSettings settings) + throws IOException { + return new HttpJsonExecutionsStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonExecutionsStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonExecutionsStub( + ExecutionsStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonExecutionsStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonExecutionsStub( + ExecutionsStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonExecutionsStub, 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 HttpJsonExecutionsStub(ExecutionsStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonExecutionsCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonExecutionsStub, 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 HttpJsonExecutionsStub( + ExecutionsStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings getExecutionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getExecutionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listExecutionsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listExecutionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteExecutionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteExecutionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.getExecutionCallable = + callableFactory.createUnaryCallable( + getExecutionTransportSettings, settings.getExecutionSettings(), clientContext); + this.listExecutionsCallable = + callableFactory.createUnaryCallable( + listExecutionsTransportSettings, settings.listExecutionsSettings(), clientContext); + this.listExecutionsPagedCallable = + callableFactory.createPagedCallable( + listExecutionsTransportSettings, settings.listExecutionsSettings(), clientContext); + this.deleteExecutionCallable = + callableFactory.createUnaryCallable( + deleteExecutionTransportSettings, settings.deleteExecutionSettings(), clientContext); + this.deleteExecutionOperationCallable = + callableFactory.createOperationCallable( + deleteExecutionTransportSettings, + settings.deleteExecutionOperationSettings(), + clientContext, + httpJsonOperationsStub); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(getExecutionMethodDescriptor); + methodDescriptors.add(listExecutionsMethodDescriptor); + methodDescriptors.add(deleteExecutionMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable getExecutionCallable() { + return getExecutionCallable; + } + + @Override + public UnaryCallable listExecutionsCallable() { + return listExecutionsCallable; + } + + @Override + public UnaryCallable + listExecutionsPagedCallable() { + return listExecutionsPagedCallable; + } + + @Override + public UnaryCallable deleteExecutionCallable() { + return deleteExecutionCallable; + } + + @Override + public OperationCallable + deleteExecutionOperationCallable() { + return deleteExecutionOperationCallable; + } + + @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/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonJobsCallableFactory.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonJobsCallableFactory.java new file mode 100644 index 000000000000..9575507004c6 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonJobsCallableFactory.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.run.v2.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 Jobs service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonJobsCallableFactory + 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/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonJobsStub.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonJobsStub.java new file mode 100644 index 000000000000..27372078fc2d --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonJobsStub.java @@ -0,0 +1,689 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2.stub; + +import static com.google.cloud.run.v2.JobsClient.ListJobsPagedResponse; + +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.run.v2.CreateJobRequest; +import com.google.cloud.run.v2.DeleteJobRequest; +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.GetJobRequest; +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.ListJobsRequest; +import com.google.cloud.run.v2.ListJobsResponse; +import com.google.cloud.run.v2.RunJobRequest; +import com.google.cloud.run.v2.UpdateJobRequest; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +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 Jobs service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonJobsStub extends JobsStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder().add(Execution.getDescriptor()).add(Job.getDescriptor()).build(); + + private static final ApiMethodDescriptor createJobMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.run.v2.Jobs/CreateJob") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*}/jobs", + 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, "jobId", request.getJobId()); + serializer.putQueryParam(fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("job", request.getJob(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateJobRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor getJobMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.run.v2.Jobs/GetJob") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/jobs/*}", + 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(Job.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listJobsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.run.v2.Jobs/ListJobs") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*}/jobs", + 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()); + serializer.putQueryParam( + fields, "showDeleted", request.getShowDeleted()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListJobsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor updateJobMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.run.v2.Jobs/UpdateJob") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{job.name=projects/*/locations/*/jobs/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "job.name", request.getJob().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "allowMissing", request.getAllowMissing()); + serializer.putQueryParam(fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("job", request.getJob(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateJobRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor deleteJobMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.run.v2.Jobs/DeleteJob") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/jobs/*}", + 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, "etag", request.getEtag()); + serializer.putQueryParam(fields, "validateOnly", request.getValidateOnly()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteJobRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor runJobMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.run.v2.Jobs/RunJob") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/jobs/*}:run", + 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(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (RunJobRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getIamPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.run.v2.Jobs/GetIamPolicy") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{resource=projects/*/locations/*/jobs/*}:getIamPolicy", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "options", request.getOptions()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + setIamPolicyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.run.v2.Jobs/SetIamPolicy") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{resource=projects/*/locations/*/jobs/*}:setIamPolicy", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearResource().build(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Policy.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + testIamPermissionsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.run.v2.Jobs/TestIamPermissions") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{resource=projects/*/locations/*/jobs/*}:testIamPermissions", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearResource().build(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(TestIamPermissionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable createJobCallable; + private final OperationCallable createJobOperationCallable; + private final UnaryCallable getJobCallable; + private final UnaryCallable listJobsCallable; + private final UnaryCallable listJobsPagedCallable; + private final UnaryCallable updateJobCallable; + private final OperationCallable updateJobOperationCallable; + private final UnaryCallable deleteJobCallable; + private final OperationCallable deleteJobOperationCallable; + private final UnaryCallable runJobCallable; + private final OperationCallable runJobOperationCallable; + private final UnaryCallable getIamPolicyCallable; + private final UnaryCallable setIamPolicyCallable; + private final UnaryCallable + testIamPermissionsCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonJobsStub create(JobsStubSettings settings) throws IOException { + return new HttpJsonJobsStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonJobsStub create(ClientContext clientContext) throws IOException { + return new HttpJsonJobsStub(JobsStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonJobsStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonJobsStub( + JobsStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonJobsStub, 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 HttpJsonJobsStub(JobsStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonJobsCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonJobsStub, 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 HttpJsonJobsStub( + JobsStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings createJobTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createJobMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getJobTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getJobMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listJobsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listJobsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateJobTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateJobMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteJobTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteJobMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings runJobTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(runJobMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getIamPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getIamPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings setIamPolicyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(setIamPolicyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + testIamPermissionsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(testIamPermissionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.createJobCallable = + callableFactory.createUnaryCallable( + createJobTransportSettings, settings.createJobSettings(), clientContext); + this.createJobOperationCallable = + callableFactory.createOperationCallable( + createJobTransportSettings, + settings.createJobOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getJobCallable = + callableFactory.createUnaryCallable( + getJobTransportSettings, settings.getJobSettings(), clientContext); + this.listJobsCallable = + callableFactory.createUnaryCallable( + listJobsTransportSettings, settings.listJobsSettings(), clientContext); + this.listJobsPagedCallable = + callableFactory.createPagedCallable( + listJobsTransportSettings, settings.listJobsSettings(), clientContext); + this.updateJobCallable = + callableFactory.createUnaryCallable( + updateJobTransportSettings, settings.updateJobSettings(), clientContext); + this.updateJobOperationCallable = + callableFactory.createOperationCallable( + updateJobTransportSettings, + settings.updateJobOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteJobCallable = + callableFactory.createUnaryCallable( + deleteJobTransportSettings, settings.deleteJobSettings(), clientContext); + this.deleteJobOperationCallable = + callableFactory.createOperationCallable( + deleteJobTransportSettings, + settings.deleteJobOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.runJobCallable = + callableFactory.createUnaryCallable( + runJobTransportSettings, settings.runJobSettings(), clientContext); + this.runJobOperationCallable = + callableFactory.createOperationCallable( + runJobTransportSettings, + settings.runJobOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getIamPolicyCallable = + callableFactory.createUnaryCallable( + getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); + this.setIamPolicyCallable = + callableFactory.createUnaryCallable( + setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); + this.testIamPermissionsCallable = + callableFactory.createUnaryCallable( + testIamPermissionsTransportSettings, + settings.testIamPermissionsSettings(), + clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createJobMethodDescriptor); + methodDescriptors.add(getJobMethodDescriptor); + methodDescriptors.add(listJobsMethodDescriptor); + methodDescriptors.add(updateJobMethodDescriptor); + methodDescriptors.add(deleteJobMethodDescriptor); + methodDescriptors.add(runJobMethodDescriptor); + methodDescriptors.add(getIamPolicyMethodDescriptor); + methodDescriptors.add(setIamPolicyMethodDescriptor); + methodDescriptors.add(testIamPermissionsMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable createJobCallable() { + return createJobCallable; + } + + @Override + public OperationCallable createJobOperationCallable() { + return createJobOperationCallable; + } + + @Override + public UnaryCallable getJobCallable() { + return getJobCallable; + } + + @Override + public UnaryCallable listJobsCallable() { + return listJobsCallable; + } + + @Override + public UnaryCallable listJobsPagedCallable() { + return listJobsPagedCallable; + } + + @Override + public UnaryCallable updateJobCallable() { + return updateJobCallable; + } + + @Override + public OperationCallable updateJobOperationCallable() { + return updateJobOperationCallable; + } + + @Override + public UnaryCallable deleteJobCallable() { + return deleteJobCallable; + } + + @Override + public OperationCallable deleteJobOperationCallable() { + return deleteJobOperationCallable; + } + + @Override + public UnaryCallable runJobCallable() { + return runJobCallable; + } + + @Override + public OperationCallable runJobOperationCallable() { + return runJobOperationCallable; + } + + @Override + public UnaryCallable getIamPolicyCallable() { + return getIamPolicyCallable; + } + + @Override + public UnaryCallable setIamPolicyCallable() { + return setIamPolicyCallable; + } + + @Override + public UnaryCallable + testIamPermissionsCallable() { + return testIamPermissionsCallable; + } + + @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/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonTasksCallableFactory.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonTasksCallableFactory.java new file mode 100644 index 000000000000..032977034fe2 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonTasksCallableFactory.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.run.v2.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 Tasks service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonTasksCallableFactory + 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/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonTasksStub.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonTasksStub.java new file mode 100644 index 000000000000..4dc759b4d9cc --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/HttpJsonTasksStub.java @@ -0,0 +1,252 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2.stub; + +import static com.google.cloud.run.v2.TasksClient.ListTasksPagedResponse; + +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.run.v2.GetTaskRequest; +import com.google.cloud.run.v2.ListTasksRequest; +import com.google.cloud.run.v2.ListTasksResponse; +import com.google.cloud.run.v2.Task; +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 Tasks service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonTasksStub extends TasksStub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor getTaskMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.run.v2.Tasks/GetTask") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/jobs/*/executions/*/tasks/*}", + 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(Task.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listTasksMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.run.v2.Tasks/ListTasks") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*/jobs/*/executions/*}/tasks", + 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()); + serializer.putQueryParam( + fields, "showDeleted", request.getShowDeleted()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListTasksResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable getTaskCallable; + private final UnaryCallable listTasksCallable; + private final UnaryCallable listTasksPagedCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonTasksStub create(TasksStubSettings settings) throws IOException { + return new HttpJsonTasksStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonTasksStub create(ClientContext clientContext) throws IOException { + return new HttpJsonTasksStub(TasksStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonTasksStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonTasksStub( + TasksStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonTasksStub, 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 HttpJsonTasksStub(TasksStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonTasksCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonTasksStub, 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 HttpJsonTasksStub( + TasksStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings getTaskTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getTaskMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listTasksTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listTasksMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.getTaskCallable = + callableFactory.createUnaryCallable( + getTaskTransportSettings, settings.getTaskSettings(), clientContext); + this.listTasksCallable = + callableFactory.createUnaryCallable( + listTasksTransportSettings, settings.listTasksSettings(), clientContext); + this.listTasksPagedCallable = + callableFactory.createPagedCallable( + listTasksTransportSettings, settings.listTasksSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(getTaskMethodDescriptor); + methodDescriptors.add(listTasksMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable getTaskCallable() { + return getTaskCallable; + } + + @Override + public UnaryCallable listTasksCallable() { + return listTasksCallable; + } + + @Override + public UnaryCallable listTasksPagedCallable() { + return listTasksPagedCallable; + } + + @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/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/JobsStub.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/JobsStub.java new file mode 100644 index 000000000000..3489e724fed8 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/JobsStub.java @@ -0,0 +1,118 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2.stub; + +import static com.google.cloud.run.v2.JobsClient.ListJobsPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.run.v2.CreateJobRequest; +import com.google.cloud.run.v2.DeleteJobRequest; +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.GetJobRequest; +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.ListJobsRequest; +import com.google.cloud.run.v2.ListJobsResponse; +import com.google.cloud.run.v2.RunJobRequest; +import com.google.cloud.run.v2.UpdateJobRequest; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the Jobs service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class JobsStub implements BackgroundResource { + + public OperationsStub getOperationsStub() { + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; + } + + public OperationCallable createJobOperationCallable() { + throw new UnsupportedOperationException("Not implemented: createJobOperationCallable()"); + } + + public UnaryCallable createJobCallable() { + throw new UnsupportedOperationException("Not implemented: createJobCallable()"); + } + + public UnaryCallable getJobCallable() { + throw new UnsupportedOperationException("Not implemented: getJobCallable()"); + } + + public UnaryCallable listJobsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listJobsPagedCallable()"); + } + + public UnaryCallable listJobsCallable() { + throw new UnsupportedOperationException("Not implemented: listJobsCallable()"); + } + + public OperationCallable updateJobOperationCallable() { + throw new UnsupportedOperationException("Not implemented: updateJobOperationCallable()"); + } + + public UnaryCallable updateJobCallable() { + throw new UnsupportedOperationException("Not implemented: updateJobCallable()"); + } + + public OperationCallable deleteJobOperationCallable() { + throw new UnsupportedOperationException("Not implemented: deleteJobOperationCallable()"); + } + + public UnaryCallable deleteJobCallable() { + throw new UnsupportedOperationException("Not implemented: deleteJobCallable()"); + } + + public OperationCallable runJobOperationCallable() { + throw new UnsupportedOperationException("Not implemented: runJobOperationCallable()"); + } + + public UnaryCallable runJobCallable() { + throw new UnsupportedOperationException("Not implemented: runJobCallable()"); + } + + public UnaryCallable getIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: getIamPolicyCallable()"); + } + + public UnaryCallable setIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: setIamPolicyCallable()"); + } + + public UnaryCallable + testIamPermissionsCallable() { + throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/JobsStubSettings.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/JobsStubSettings.java new file mode 100644 index 000000000000..dc21d514d29d --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/JobsStubSettings.java @@ -0,0 +1,732 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2.stub; + +import static com.google.cloud.run.v2.JobsClient.ListJobsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +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.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; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.run.v2.CreateJobRequest; +import com.google.cloud.run.v2.DeleteJobRequest; +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.GetJobRequest; +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.ListJobsRequest; +import com.google.cloud.run.v2.ListJobsResponse; +import com.google.cloud.run.v2.RunJobRequest; +import com.google.cloud.run.v2.UpdateJobRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link JobsStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (run.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getJob to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * JobsStubSettings.Builder jobsSettingsBuilder = JobsStubSettings.newBuilder();
+ * jobsSettingsBuilder
+ *     .getJobSettings()
+ *     .setRetrySettings(
+ *         jobsSettingsBuilder.getJobSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * JobsStubSettings jobsSettings = jobsSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class JobsStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings createJobSettings; + private final OperationCallSettings createJobOperationSettings; + private final UnaryCallSettings getJobSettings; + private final PagedCallSettings + listJobsSettings; + private final UnaryCallSettings updateJobSettings; + private final OperationCallSettings updateJobOperationSettings; + private final UnaryCallSettings deleteJobSettings; + private final OperationCallSettings deleteJobOperationSettings; + private final UnaryCallSettings runJobSettings; + private final OperationCallSettings runJobOperationSettings; + private final UnaryCallSettings getIamPolicySettings; + private final UnaryCallSettings setIamPolicySettings; + private final UnaryCallSettings + testIamPermissionsSettings; + + private static final PagedListDescriptor + LIST_JOBS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListJobsRequest injectToken(ListJobsRequest payload, String token) { + return ListJobsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListJobsRequest injectPageSize(ListJobsRequest payload, int pageSize) { + return ListJobsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListJobsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListJobsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListJobsResponse payload) { + return payload.getJobsList() == null + ? ImmutableList.of() + : payload.getJobsList(); + } + }; + + private static final PagedListResponseFactory< + ListJobsRequest, ListJobsResponse, ListJobsPagedResponse> + LIST_JOBS_PAGE_STR_FACT = + new PagedListResponseFactory() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListJobsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_JOBS_PAGE_STR_DESC, request, context); + return ListJobsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to createJob. */ + public UnaryCallSettings createJobSettings() { + return createJobSettings; + } + + /** Returns the object with the settings used for calls to createJob. */ + public OperationCallSettings createJobOperationSettings() { + return createJobOperationSettings; + } + + /** Returns the object with the settings used for calls to getJob. */ + public UnaryCallSettings getJobSettings() { + return getJobSettings; + } + + /** Returns the object with the settings used for calls to listJobs. */ + public PagedCallSettings + listJobsSettings() { + return listJobsSettings; + } + + /** Returns the object with the settings used for calls to updateJob. */ + public UnaryCallSettings updateJobSettings() { + return updateJobSettings; + } + + /** Returns the object with the settings used for calls to updateJob. */ + public OperationCallSettings updateJobOperationSettings() { + return updateJobOperationSettings; + } + + /** Returns the object with the settings used for calls to deleteJob. */ + public UnaryCallSettings deleteJobSettings() { + return deleteJobSettings; + } + + /** Returns the object with the settings used for calls to deleteJob. */ + public OperationCallSettings deleteJobOperationSettings() { + return deleteJobOperationSettings; + } + + /** Returns the object with the settings used for calls to runJob. */ + public UnaryCallSettings runJobSettings() { + return runJobSettings; + } + + /** Returns the object with the settings used for calls to runJob. */ + public OperationCallSettings runJobOperationSettings() { + return runJobOperationSettings; + } + + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + + public JobsStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcJobsStub.create(this); + } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonJobsStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "run.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "run.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** 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 defaultGrpcApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(JobsStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + @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(JobsStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return JobsStubSettings.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); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected JobsStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + createJobSettings = settingsBuilder.createJobSettings().build(); + createJobOperationSettings = settingsBuilder.createJobOperationSettings().build(); + getJobSettings = settingsBuilder.getJobSettings().build(); + listJobsSettings = settingsBuilder.listJobsSettings().build(); + updateJobSettings = settingsBuilder.updateJobSettings().build(); + updateJobOperationSettings = settingsBuilder.updateJobOperationSettings().build(); + deleteJobSettings = settingsBuilder.deleteJobSettings().build(); + deleteJobOperationSettings = settingsBuilder.deleteJobOperationSettings().build(); + runJobSettings = settingsBuilder.runJobSettings().build(); + runJobOperationSettings = settingsBuilder.runJobOperationSettings().build(); + getIamPolicySettings = settingsBuilder.getIamPolicySettings().build(); + setIamPolicySettings = settingsBuilder.setIamPolicySettings().build(); + testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); + } + + /** Builder for JobsStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder createJobSettings; + private final OperationCallSettings.Builder + createJobOperationSettings; + private final UnaryCallSettings.Builder getJobSettings; + private final PagedCallSettings.Builder< + ListJobsRequest, ListJobsResponse, ListJobsPagedResponse> + listJobsSettings; + private final UnaryCallSettings.Builder updateJobSettings; + private final OperationCallSettings.Builder + updateJobOperationSettings; + private final UnaryCallSettings.Builder deleteJobSettings; + private final OperationCallSettings.Builder + deleteJobOperationSettings; + private final UnaryCallSettings.Builder runJobSettings; + private final OperationCallSettings.Builder + runJobOperationSettings; + private final UnaryCallSettings.Builder getIamPolicySettings; + private final UnaryCallSettings.Builder setIamPolicySettings; + private final UnaryCallSettings.Builder + testIamPermissionsSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + createJobSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createJobOperationSettings = OperationCallSettings.newBuilder(); + getJobSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listJobsSettings = PagedCallSettings.newBuilder(LIST_JOBS_PAGE_STR_FACT); + updateJobSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateJobOperationSettings = OperationCallSettings.newBuilder(); + deleteJobSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteJobOperationSettings = OperationCallSettings.newBuilder(); + runJobSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + runJobOperationSettings = OperationCallSettings.newBuilder(); + getIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createJobSettings, + getJobSettings, + listJobsSettings, + updateJobSettings, + deleteJobSettings, + runJobSettings, + getIamPolicySettings, + setIamPolicySettings, + testIamPermissionsSettings); + initDefaults(this); + } + + protected Builder(JobsStubSettings settings) { + super(settings); + + createJobSettings = settings.createJobSettings.toBuilder(); + createJobOperationSettings = settings.createJobOperationSettings.toBuilder(); + getJobSettings = settings.getJobSettings.toBuilder(); + listJobsSettings = settings.listJobsSettings.toBuilder(); + updateJobSettings = settings.updateJobSettings.toBuilder(); + updateJobOperationSettings = settings.updateJobOperationSettings.toBuilder(); + deleteJobSettings = settings.deleteJobSettings.toBuilder(); + deleteJobOperationSettings = settings.deleteJobOperationSettings.toBuilder(); + runJobSettings = settings.runJobSettings.toBuilder(); + runJobOperationSettings = settings.runJobOperationSettings.toBuilder(); + getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); + setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); + testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createJobSettings, + getJobSettings, + listJobsSettings, + updateJobSettings, + deleteJobSettings, + runJobSettings, + getIamPolicySettings, + setIamPolicySettings, + testIamPermissionsSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + 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 + .createJobSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .getJobSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .listJobsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .updateJobSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .deleteJobSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .runJobSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .getIamPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .setIamPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .testIamPermissionsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .createJobOperationSettings() + .setInitialCallSettings( + UnaryCallSettings.newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) + .build()) + .setResponseTransformer(ProtoOperationTransformers.ResponseTransformer.create(Job.class)) + .setMetadataTransformer(ProtoOperationTransformers.MetadataTransformer.create(Job.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .updateJobOperationSettings() + .setInitialCallSettings( + UnaryCallSettings.newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) + .build()) + .setResponseTransformer(ProtoOperationTransformers.ResponseTransformer.create(Job.class)) + .setMetadataTransformer(ProtoOperationTransformers.MetadataTransformer.create(Job.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .deleteJobOperationSettings() + .setInitialCallSettings( + UnaryCallSettings.newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) + .build()) + .setResponseTransformer(ProtoOperationTransformers.ResponseTransformer.create(Job.class)) + .setMetadataTransformer(ProtoOperationTransformers.MetadataTransformer.create(Job.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .runJobOperationSettings() + .setInitialCallSettings( + UnaryCallSettings.newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Execution.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(Execution.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + return builder; + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to createJob. */ + public UnaryCallSettings.Builder createJobSettings() { + return createJobSettings; + } + + /** Returns the builder for the settings used for calls to createJob. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder createJobOperationSettings() { + return createJobOperationSettings; + } + + /** Returns the builder for the settings used for calls to getJob. */ + public UnaryCallSettings.Builder getJobSettings() { + return getJobSettings; + } + + /** Returns the builder for the settings used for calls to listJobs. */ + public PagedCallSettings.Builder + listJobsSettings() { + return listJobsSettings; + } + + /** Returns the builder for the settings used for calls to updateJob. */ + public UnaryCallSettings.Builder updateJobSettings() { + return updateJobSettings; + } + + /** Returns the builder for the settings used for calls to updateJob. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder updateJobOperationSettings() { + return updateJobOperationSettings; + } + + /** Returns the builder for the settings used for calls to deleteJob. */ + public UnaryCallSettings.Builder deleteJobSettings() { + return deleteJobSettings; + } + + /** Returns the builder for the settings used for calls to deleteJob. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder deleteJobOperationSettings() { + return deleteJobOperationSettings; + } + + /** Returns the builder for the settings used for calls to runJob. */ + public UnaryCallSettings.Builder runJobSettings() { + return runJobSettings; + } + + /** Returns the builder for the settings used for calls to runJob. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + runJobOperationSettings() { + return runJobOperationSettings; + } + + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + + @Override + public JobsStubSettings build() throws IOException { + return new JobsStubSettings(this); + } + } +} diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/TasksStub.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/TasksStub.java new file mode 100644 index 000000000000..9a376d626518 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/TasksStub.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.run.v2.stub; + +import static com.google.cloud.run.v2.TasksClient.ListTasksPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.run.v2.GetTaskRequest; +import com.google.cloud.run.v2.ListTasksRequest; +import com.google.cloud.run.v2.ListTasksResponse; +import com.google.cloud.run.v2.Task; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the Tasks service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class TasksStub implements BackgroundResource { + + public UnaryCallable getTaskCallable() { + throw new UnsupportedOperationException("Not implemented: getTaskCallable()"); + } + + public UnaryCallable listTasksPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listTasksPagedCallable()"); + } + + public UnaryCallable listTasksCallable() { + throw new UnsupportedOperationException("Not implemented: listTasksCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/TasksStubSettings.java b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/TasksStubSettings.java new file mode 100644 index 000000000000..e398354c4701 --- /dev/null +++ b/java-run/google-cloud-run/src/main/java/com/google/cloud/run/v2/stub/TasksStubSettings.java @@ -0,0 +1,396 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2.stub; + +import static com.google.cloud.run.v2.TasksClient.ListTasksPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +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; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.run.v2.GetTaskRequest; +import com.google.cloud.run.v2.ListTasksRequest; +import com.google.cloud.run.v2.ListTasksResponse; +import com.google.cloud.run.v2.Task; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link TasksStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (run.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getTask to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * TasksStubSettings.Builder tasksSettingsBuilder = TasksStubSettings.newBuilder();
+ * tasksSettingsBuilder
+ *     .getTaskSettings()
+ *     .setRetrySettings(
+ *         tasksSettingsBuilder.getTaskSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * TasksStubSettings tasksSettings = tasksSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class TasksStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings getTaskSettings; + private final PagedCallSettings + listTasksSettings; + + private static final PagedListDescriptor + LIST_TASKS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListTasksRequest injectToken(ListTasksRequest payload, String token) { + return ListTasksRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListTasksRequest injectPageSize(ListTasksRequest payload, int pageSize) { + return ListTasksRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListTasksRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListTasksResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListTasksResponse payload) { + return payload.getTasksList() == null + ? ImmutableList.of() + : payload.getTasksList(); + } + }; + + private static final PagedListResponseFactory< + ListTasksRequest, ListTasksResponse, ListTasksPagedResponse> + LIST_TASKS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListTasksRequest, ListTasksResponse, ListTasksPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListTasksRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_TASKS_PAGE_STR_DESC, request, context); + return ListTasksPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to getTask. */ + public UnaryCallSettings getTaskSettings() { + return getTaskSettings; + } + + /** Returns the object with the settings used for calls to listTasks. */ + public PagedCallSettings + listTasksSettings() { + return listTasksSettings; + } + + public TasksStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcTasksStub.create(this); + } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonTasksStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "run.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "run.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** 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 defaultGrpcApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(TasksStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + @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(TasksStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return TasksStubSettings.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); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected TasksStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + getTaskSettings = settingsBuilder.getTaskSettings().build(); + listTasksSettings = settingsBuilder.listTasksSettings().build(); + } + + /** Builder for TasksStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder getTaskSettings; + private final PagedCallSettings.Builder< + ListTasksRequest, ListTasksResponse, ListTasksPagedResponse> + listTasksSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + getTaskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listTasksSettings = PagedCallSettings.newBuilder(LIST_TASKS_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of(getTaskSettings, listTasksSettings); + initDefaults(this); + } + + protected Builder(TasksStubSettings settings) { + super(settings); + + getTaskSettings = settings.getTaskSettings.toBuilder(); + listTasksSettings = settings.listTasksSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of(getTaskSettings, listTasksSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + 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 + .getTaskSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .listTasksSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + return builder; + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to getTask. */ + public UnaryCallSettings.Builder getTaskSettings() { + return getTaskSettings; + } + + /** Returns the builder for the settings used for calls to listTasks. */ + public PagedCallSettings.Builder + listTasksSettings() { + return listTasksSettings; + } + + @Override + public TasksStubSettings build() throws IOException { + return new TasksStubSettings(this); + } + } +} diff --git a/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/ExecutionsClientHttpJsonTest.java b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/ExecutionsClientHttpJsonTest.java new file mode 100644 index 000000000000..69fb5b2701e9 --- /dev/null +++ b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/ExecutionsClientHttpJsonTest.java @@ -0,0 +1,461 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import static com.google.cloud.run.v2.ExecutionsClient.ListExecutionsPagedResponse; + +import com.google.api.LaunchStage; +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.run.v2.stub.HttpJsonExecutionsStub; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +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 ExecutionsClientHttpJsonTest { + private static MockHttpService mockService; + private static ExecutionsClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonExecutionsStub.getMethodDescriptors(), ExecutionsSettings.getDefaultEndpoint()); + ExecutionsSettings settings = + ExecutionsSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + ExecutionsSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ExecutionsClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void getExecutionTest() throws Exception { + Execution expectedResponse = + Execution.newBuilder() + .setName(ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setLaunchStage(LaunchStage.forNumber(0)) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setParallelism(635164956) + .setTaskCount(1297805781) + .setTemplate(TaskTemplate.newBuilder().build()) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setRunningCount(261439119) + .setSucceededCount(633694641) + .setFailedCount(-2013829491) + .setEtag("etag3123477") + .build(); + mockService.addResponse(expectedResponse); + + ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"); + + Execution actualResponse = client.getExecution(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 getExecutionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"); + client.getExecution(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getExecutionTest2() throws Exception { + Execution expectedResponse = + Execution.newBuilder() + .setName(ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setLaunchStage(LaunchStage.forNumber(0)) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setParallelism(635164956) + .setTaskCount(1297805781) + .setTemplate(TaskTemplate.newBuilder().build()) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setRunningCount(261439119) + .setSucceededCount(633694641) + .setFailedCount(-2013829491) + .setEtag("etag3123477") + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-3087/locations/location-3087/jobs/job-3087/executions/execution-3087"; + + Execution actualResponse = client.getExecution(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 getExecutionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-3087/locations/location-3087/jobs/job-3087/executions/execution-3087"; + client.getExecution(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listExecutionsTest() throws Exception { + Execution responsesElement = Execution.newBuilder().build(); + ListExecutionsResponse expectedResponse = + ListExecutionsResponse.newBuilder() + .setNextPageToken("") + .addAllExecutions(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + JobName parent = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + + ListExecutionsPagedResponse pagedListResponse = client.listExecutions(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getExecutionsList().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 listExecutionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + JobName parent = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + client.listExecutions(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listExecutionsTest2() throws Exception { + Execution responsesElement = Execution.newBuilder().build(); + ListExecutionsResponse expectedResponse = + ListExecutionsResponse.newBuilder() + .setNextPageToken("") + .addAllExecutions(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-7113/locations/location-7113/jobs/job-7113"; + + ListExecutionsPagedResponse pagedListResponse = client.listExecutions(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getExecutionsList().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 listExecutionsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-7113/locations/location-7113/jobs/job-7113"; + client.listExecutions(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteExecutionTest() throws Exception { + Execution expectedResponse = + Execution.newBuilder() + .setName(ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setLaunchStage(LaunchStage.forNumber(0)) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setParallelism(635164956) + .setTaskCount(1297805781) + .setTemplate(TaskTemplate.newBuilder().build()) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setRunningCount(261439119) + .setSucceededCount(633694641) + .setFailedCount(-2013829491) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteExecutionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"); + + Execution actualResponse = client.deleteExecutionAsync(name).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 deleteExecutionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"); + client.deleteExecutionAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteExecutionTest2() throws Exception { + Execution expectedResponse = + Execution.newBuilder() + .setName(ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setLaunchStage(LaunchStage.forNumber(0)) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setParallelism(635164956) + .setTaskCount(1297805781) + .setTemplate(TaskTemplate.newBuilder().build()) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setRunningCount(261439119) + .setSucceededCount(633694641) + .setFailedCount(-2013829491) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteExecutionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = + "projects/project-3087/locations/location-3087/jobs/job-3087/executions/execution-3087"; + + Execution actualResponse = client.deleteExecutionAsync(name).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 deleteExecutionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-3087/locations/location-3087/jobs/job-3087/executions/execution-3087"; + client.deleteExecutionAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } +} diff --git a/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/ExecutionsClientTest.java b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/ExecutionsClientTest.java new file mode 100644 index 000000000000..2893eb694924 --- /dev/null +++ b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/ExecutionsClientTest.java @@ -0,0 +1,435 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import static com.google.cloud.run.v2.ExecutionsClient.ListExecutionsPagedResponse; + +import com.google.api.LaunchStage; +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import com.google.protobuf.Timestamp; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +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 ExecutionsClientTest { + private static MockExecutions mockExecutions; + private static MockLocations mockLocations; + private static MockServiceHelper mockServiceHelper; + private LocalChannelProvider channelProvider; + private ExecutionsClient client; + + @BeforeClass + public static void startStaticServer() { + mockExecutions = new MockExecutions(); + mockLocations = new MockLocations(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), + Arrays.asList(mockExecutions, mockLocations)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + ExecutionsSettings settings = + ExecutionsSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ExecutionsClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void getExecutionTest() throws Exception { + Execution expectedResponse = + Execution.newBuilder() + .setName(ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setLaunchStage(LaunchStage.forNumber(0)) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setParallelism(635164956) + .setTaskCount(1297805781) + .setTemplate(TaskTemplate.newBuilder().build()) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setRunningCount(261439119) + .setSucceededCount(633694641) + .setFailedCount(-2013829491) + .setEtag("etag3123477") + .build(); + mockExecutions.addResponse(expectedResponse); + + ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"); + + Execution actualResponse = client.getExecution(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockExecutions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetExecutionRequest actualRequest = ((GetExecutionRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getExecutionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockExecutions.addException(exception); + + try { + ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"); + client.getExecution(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getExecutionTest2() throws Exception { + Execution expectedResponse = + Execution.newBuilder() + .setName(ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setLaunchStage(LaunchStage.forNumber(0)) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setParallelism(635164956) + .setTaskCount(1297805781) + .setTemplate(TaskTemplate.newBuilder().build()) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setRunningCount(261439119) + .setSucceededCount(633694641) + .setFailedCount(-2013829491) + .setEtag("etag3123477") + .build(); + mockExecutions.addResponse(expectedResponse); + + String name = "name3373707"; + + Execution actualResponse = client.getExecution(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockExecutions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetExecutionRequest actualRequest = ((GetExecutionRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getExecutionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockExecutions.addException(exception); + + try { + String name = "name3373707"; + client.getExecution(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listExecutionsTest() throws Exception { + Execution responsesElement = Execution.newBuilder().build(); + ListExecutionsResponse expectedResponse = + ListExecutionsResponse.newBuilder() + .setNextPageToken("") + .addAllExecutions(Arrays.asList(responsesElement)) + .build(); + mockExecutions.addResponse(expectedResponse); + + JobName parent = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + + ListExecutionsPagedResponse pagedListResponse = client.listExecutions(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getExecutionsList().get(0), resources.get(0)); + + List actualRequests = mockExecutions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListExecutionsRequest actualRequest = ((ListExecutionsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listExecutionsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockExecutions.addException(exception); + + try { + JobName parent = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + client.listExecutions(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listExecutionsTest2() throws Exception { + Execution responsesElement = Execution.newBuilder().build(); + ListExecutionsResponse expectedResponse = + ListExecutionsResponse.newBuilder() + .setNextPageToken("") + .addAllExecutions(Arrays.asList(responsesElement)) + .build(); + mockExecutions.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListExecutionsPagedResponse pagedListResponse = client.listExecutions(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getExecutionsList().get(0), resources.get(0)); + + List actualRequests = mockExecutions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListExecutionsRequest actualRequest = ((ListExecutionsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listExecutionsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockExecutions.addException(exception); + + try { + String parent = "parent-995424086"; + client.listExecutions(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteExecutionTest() throws Exception { + Execution expectedResponse = + Execution.newBuilder() + .setName(ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setLaunchStage(LaunchStage.forNumber(0)) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setParallelism(635164956) + .setTaskCount(1297805781) + .setTemplate(TaskTemplate.newBuilder().build()) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setRunningCount(261439119) + .setSucceededCount(633694641) + .setFailedCount(-2013829491) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteExecutionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockExecutions.addResponse(resultOperation); + + ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"); + + Execution actualResponse = client.deleteExecutionAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockExecutions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteExecutionRequest actualRequest = ((DeleteExecutionRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteExecutionExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockExecutions.addException(exception); + + try { + ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"); + client.deleteExecutionAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deleteExecutionTest2() throws Exception { + Execution expectedResponse = + Execution.newBuilder() + .setName(ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setLaunchStage(LaunchStage.forNumber(0)) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setParallelism(635164956) + .setTaskCount(1297805781) + .setTemplate(TaskTemplate.newBuilder().build()) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setRunningCount(261439119) + .setSucceededCount(633694641) + .setFailedCount(-2013829491) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteExecutionTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockExecutions.addResponse(resultOperation); + + String name = "name3373707"; + + Execution actualResponse = client.deleteExecutionAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockExecutions.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteExecutionRequest actualRequest = ((DeleteExecutionRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteExecutionExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockExecutions.addException(exception); + + try { + String name = "name3373707"; + client.deleteExecutionAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } +} diff --git a/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/JobsClientHttpJsonTest.java b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/JobsClientHttpJsonTest.java new file mode 100644 index 000000000000..50edf84a8da5 --- /dev/null +++ b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/JobsClientHttpJsonTest.java @@ -0,0 +1,1042 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import static com.google.cloud.run.v2.JobsClient.ListJobsPagedResponse; + +import com.google.api.LaunchStage; +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.run.v2.stub.HttpJsonJobsStub; +import com.google.common.collect.Lists; +import com.google.iam.v1.AuditConfig; +import com.google.iam.v1.Binding; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.ByteString; +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 JobsClientHttpJsonTest { + private static MockHttpService mockService; + private static JobsClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonJobsStub.getMethodDescriptors(), JobsSettings.getDefaultEndpoint()); + JobsSettings settings = + JobsSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + JobsSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = JobsClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createJobTest() throws Exception { + Job expectedResponse = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createJobTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Job job = Job.newBuilder().build(); + String jobId = "jobId101296568"; + + Job actualResponse = client.createJobAsync(parent, job, jobId).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 createJobExceptionTest() 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]"); + Job job = Job.newBuilder().build(); + String jobId = "jobId101296568"; + client.createJobAsync(parent, job, jobId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createJobTest2() throws Exception { + Job expectedResponse = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createJobTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Job job = Job.newBuilder().build(); + String jobId = "jobId101296568"; + + Job actualResponse = client.createJobAsync(parent, job, jobId).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 createJobExceptionTest2() 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"; + Job job = Job.newBuilder().build(); + String jobId = "jobId101296568"; + client.createJobAsync(parent, job, jobId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getJobTest() throws Exception { + Job expectedResponse = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + mockService.addResponse(expectedResponse); + + JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + + Job actualResponse = client.getJob(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 getJobExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + client.getJob(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getJobTest2() throws Exception { + Job expectedResponse = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-3306/locations/location-3306/jobs/job-3306"; + + Job actualResponse = client.getJob(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 getJobExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3306/locations/location-3306/jobs/job-3306"; + client.getJob(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listJobsTest() throws Exception { + Job responsesElement = Job.newBuilder().build(); + ListJobsResponse expectedResponse = + ListJobsResponse.newBuilder() + .setNextPageToken("") + .addAllJobs(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListJobsPagedResponse pagedListResponse = client.listJobs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getJobsList().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 listJobsExceptionTest() 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.listJobs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listJobsTest2() throws Exception { + Job responsesElement = Job.newBuilder().build(); + ListJobsResponse expectedResponse = + ListJobsResponse.newBuilder() + .setNextPageToken("") + .addAllJobs(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListJobsPagedResponse pagedListResponse = client.listJobs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getJobsList().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 listJobsExceptionTest2() 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.listJobs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateJobTest() throws Exception { + Job expectedResponse = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateJobTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + Job job = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + + Job actualResponse = client.updateJobAsync(job).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 updateJobExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Job job = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + client.updateJobAsync(job).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteJobTest() throws Exception { + Job expectedResponse = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteJobTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + + Job actualResponse = client.deleteJobAsync(name).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 deleteJobExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + client.deleteJobAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteJobTest2() throws Exception { + Job expectedResponse = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteJobTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3306/locations/location-3306/jobs/job-3306"; + + Job actualResponse = client.deleteJobAsync(name).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 deleteJobExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3306/locations/location-3306/jobs/job-3306"; + client.deleteJobAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void runJobTest() throws Exception { + Execution expectedResponse = + Execution.newBuilder() + .setName(ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setLaunchStage(LaunchStage.forNumber(0)) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setParallelism(635164956) + .setTaskCount(1297805781) + .setTemplate(TaskTemplate.newBuilder().build()) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setRunningCount(261439119) + .setSucceededCount(633694641) + .setFailedCount(-2013829491) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("runJobTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + + Execution actualResponse = client.runJobAsync(name).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 runJobExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + client.runJobAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void runJobTest2() throws Exception { + Execution expectedResponse = + Execution.newBuilder() + .setName(ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setLaunchStage(LaunchStage.forNumber(0)) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setParallelism(635164956) + .setTaskCount(1297805781) + .setTemplate(TaskTemplate.newBuilder().build()) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setRunningCount(261439119) + .setSucceededCount(633694641) + .setFailedCount(-2013829491) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("runJobTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-3306/locations/location-3306/jobs/job-3306"; + + Execution actualResponse = client.runJobAsync(name).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 runJobExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3306/locations/location-3306/jobs/job-3306"; + client.runJobAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockService.addResponse(expectedResponse); + + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + + Policy actualResponse = client.getIamPolicy(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 getIamPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + client.getIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockService.addResponse(expectedResponse); + + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + + Policy actualResponse = client.setIamPolicy(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 setIamPolicyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.setIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(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 testIamPermissionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + client.testIamPermissions(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/JobsClientTest.java b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/JobsClientTest.java new file mode 100644 index 000000000000..8aa1cf4b479b --- /dev/null +++ b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/JobsClientTest.java @@ -0,0 +1,944 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import static com.google.cloud.run.v2.JobsClient.ListJobsPagedResponse; + +import com.google.api.LaunchStage; +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.common.collect.Lists; +import com.google.iam.v1.AuditConfig; +import com.google.iam.v1.Binding; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import com.google.protobuf.ByteString; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +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 JobsClientTest { + private static MockJobs mockJobs; + private static MockLocations mockLocations; + private static MockServiceHelper mockServiceHelper; + private LocalChannelProvider channelProvider; + private JobsClient client; + + @BeforeClass + public static void startStaticServer() { + mockJobs = new MockJobs(); + mockLocations = new MockLocations(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockJobs, mockLocations)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + JobsSettings settings = + JobsSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = JobsClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void createJobTest() throws Exception { + Job expectedResponse = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createJobTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockJobs.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Job job = Job.newBuilder().build(); + String jobId = "jobId101296568"; + + Job actualResponse = client.createJobAsync(parent, job, jobId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockJobs.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateJobRequest actualRequest = ((CreateJobRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(job, actualRequest.getJob()); + Assert.assertEquals(jobId, actualRequest.getJobId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createJobExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockJobs.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Job job = Job.newBuilder().build(); + String jobId = "jobId101296568"; + client.createJobAsync(parent, job, jobId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void createJobTest2() throws Exception { + Job expectedResponse = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createJobTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockJobs.addResponse(resultOperation); + + String parent = "parent-995424086"; + Job job = Job.newBuilder().build(); + String jobId = "jobId101296568"; + + Job actualResponse = client.createJobAsync(parent, job, jobId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockJobs.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateJobRequest actualRequest = ((CreateJobRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(job, actualRequest.getJob()); + Assert.assertEquals(jobId, actualRequest.getJobId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createJobExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockJobs.addException(exception); + + try { + String parent = "parent-995424086"; + Job job = Job.newBuilder().build(); + String jobId = "jobId101296568"; + client.createJobAsync(parent, job, jobId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void getJobTest() throws Exception { + Job expectedResponse = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + mockJobs.addResponse(expectedResponse); + + JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + + Job actualResponse = client.getJob(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockJobs.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetJobRequest actualRequest = ((GetJobRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getJobExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockJobs.addException(exception); + + try { + JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + client.getJob(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getJobTest2() throws Exception { + Job expectedResponse = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + mockJobs.addResponse(expectedResponse); + + String name = "name3373707"; + + Job actualResponse = client.getJob(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockJobs.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetJobRequest actualRequest = ((GetJobRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getJobExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockJobs.addException(exception); + + try { + String name = "name3373707"; + client.getJob(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listJobsTest() throws Exception { + Job responsesElement = Job.newBuilder().build(); + ListJobsResponse expectedResponse = + ListJobsResponse.newBuilder() + .setNextPageToken("") + .addAllJobs(Arrays.asList(responsesElement)) + .build(); + mockJobs.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListJobsPagedResponse pagedListResponse = client.listJobs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getJobsList().get(0), resources.get(0)); + + List actualRequests = mockJobs.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListJobsRequest actualRequest = ((ListJobsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listJobsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockJobs.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listJobs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listJobsTest2() throws Exception { + Job responsesElement = Job.newBuilder().build(); + ListJobsResponse expectedResponse = + ListJobsResponse.newBuilder() + .setNextPageToken("") + .addAllJobs(Arrays.asList(responsesElement)) + .build(); + mockJobs.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListJobsPagedResponse pagedListResponse = client.listJobs(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getJobsList().get(0), resources.get(0)); + + List actualRequests = mockJobs.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListJobsRequest actualRequest = ((ListJobsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listJobsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockJobs.addException(exception); + + try { + String parent = "parent-995424086"; + client.listJobs(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateJobTest() throws Exception { + Job expectedResponse = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateJobTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockJobs.addResponse(resultOperation); + + Job job = Job.newBuilder().build(); + + Job actualResponse = client.updateJobAsync(job).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockJobs.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateJobRequest actualRequest = ((UpdateJobRequest) actualRequests.get(0)); + + Assert.assertEquals(job, actualRequest.getJob()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateJobExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockJobs.addException(exception); + + try { + Job job = Job.newBuilder().build(); + client.updateJobAsync(job).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deleteJobTest() throws Exception { + Job expectedResponse = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteJobTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockJobs.addResponse(resultOperation); + + JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + + Job actualResponse = client.deleteJobAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockJobs.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteJobRequest actualRequest = ((DeleteJobRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteJobExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockJobs.addException(exception); + + try { + JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + client.deleteJobAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deleteJobTest2() throws Exception { + Job expectedResponse = + Job.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setCreator("creator1028554796") + .setLastModifier("lastModifier1959003021") + .setClient("client-1357712437") + .setClientVersion("clientVersion771880589") + .setLaunchStage(LaunchStage.forNumber(0)) + .setBinaryAuthorization(BinaryAuthorization.newBuilder().build()) + .setTemplate(ExecutionTemplate.newBuilder().build()) + .setObservedGeneration(900833007) + .setTerminalCondition(Condition.newBuilder().build()) + .addAllConditions(new ArrayList()) + .setExecutionCount(1646136616) + .setLatestCreatedExecution(ExecutionReference.newBuilder().build()) + .setReconciling(true) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteJobTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockJobs.addResponse(resultOperation); + + String name = "name3373707"; + + Job actualResponse = client.deleteJobAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockJobs.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteJobRequest actualRequest = ((DeleteJobRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteJobExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockJobs.addException(exception); + + try { + String name = "name3373707"; + client.deleteJobAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void runJobTest() throws Exception { + Execution expectedResponse = + Execution.newBuilder() + .setName(ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setLaunchStage(LaunchStage.forNumber(0)) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setParallelism(635164956) + .setTaskCount(1297805781) + .setTemplate(TaskTemplate.newBuilder().build()) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setRunningCount(261439119) + .setSucceededCount(633694641) + .setFailedCount(-2013829491) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("runJobTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockJobs.addResponse(resultOperation); + + JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + + Execution actualResponse = client.runJobAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockJobs.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + RunJobRequest actualRequest = ((RunJobRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void runJobExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockJobs.addException(exception); + + try { + JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + client.runJobAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void runJobTest2() throws Exception { + Execution expectedResponse = + Execution.newBuilder() + .setName(ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setLaunchStage(LaunchStage.forNumber(0)) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setParallelism(635164956) + .setTaskCount(1297805781) + .setTemplate(TaskTemplate.newBuilder().build()) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setRunningCount(261439119) + .setSucceededCount(633694641) + .setFailedCount(-2013829491) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("runJobTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockJobs.addResponse(resultOperation); + + String name = "name3373707"; + + Execution actualResponse = client.runJobAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockJobs.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + RunJobRequest actualRequest = ((RunJobRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void runJobExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockJobs.addException(exception); + + try { + String name = "name3373707"; + client.runJobAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockJobs.addResponse(expectedResponse); + + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + + Policy actualResponse = client.getIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockJobs.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getOptions(), actualRequest.getOptions()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockJobs.addException(exception); + + try { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + client.getIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockJobs.addResponse(expectedResponse); + + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + + Policy actualResponse = client.setIamPolicy(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockJobs.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPolicy(), actualRequest.getPolicy()); + Assert.assertEquals(request.getUpdateMask(), actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void setIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockJobs.addException(exception); + + try { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + client.setIamPolicy(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockJobs.addResponse(expectedResponse); + + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockJobs.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getPermissionsList(), actualRequest.getPermissionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void testIamPermissionsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockJobs.addException(exception); + + try { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + client.testIamPermissions(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockExecutions.java b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockExecutions.java new file mode 100644 index 000000000000..224f8e5ab6f1 --- /dev/null +++ b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockExecutions.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.run.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockExecutions implements MockGrpcService { + private final MockExecutionsImpl serviceImpl; + + public MockExecutions() { + serviceImpl = new MockExecutionsImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockExecutionsImpl.java b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockExecutionsImpl.java new file mode 100644 index 000000000000..410c6652b759 --- /dev/null +++ b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockExecutionsImpl.java @@ -0,0 +1,124 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import com.google.api.core.BetaApi; +import com.google.cloud.run.v2.ExecutionsGrpc.ExecutionsImplBase; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockExecutionsImpl extends ExecutionsImplBase { + private List requests; + private Queue responses; + + public MockExecutionsImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void getExecution( + GetExecutionRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Execution) { + requests.add(request); + responseObserver.onNext(((Execution) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetExecution, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Execution.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listExecutions( + ListExecutionsRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListExecutionsResponse) { + requests.add(request); + responseObserver.onNext(((ListExecutionsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListExecutions, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListExecutionsResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteExecution( + DeleteExecutionRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteExecution, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockJobs.java b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockJobs.java new file mode 100644 index 000000000000..a16326355a51 --- /dev/null +++ b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockJobs.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.run.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockJobs implements MockGrpcService { + private final MockJobsImpl serviceImpl; + + public MockJobs() { + serviceImpl = new MockJobsImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockJobsImpl.java b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockJobsImpl.java new file mode 100644 index 000000000000..f92186cecdad --- /dev/null +++ b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockJobsImpl.java @@ -0,0 +1,248 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import com.google.api.core.BetaApi; +import com.google.cloud.run.v2.JobsGrpc.JobsImplBase; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockJobsImpl extends JobsImplBase { + private List requests; + private Queue responses; + + public MockJobsImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void createJob(CreateJobRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateJob, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getJob(GetJobRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Job) { + requests.add(request); + responseObserver.onNext(((Job) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetJob, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Job.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listJobs(ListJobsRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListJobsResponse) { + requests.add(request); + responseObserver.onNext(((ListJobsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListJobs, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListJobsResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateJob(UpdateJobRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateJob, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteJob(DeleteJobRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteJob, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void runJob(RunJobRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method RunJob, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getIamPolicy(GetIamPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Policy) { + requests.add(request); + responseObserver.onNext(((Policy) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetIamPolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Policy.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void setIamPolicy(SetIamPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Policy) { + requests.add(request); + responseObserver.onNext(((Policy) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method SetIamPolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Policy.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void testIamPermissions( + TestIamPermissionsRequest request, + StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof TestIamPermissionsResponse) { + requests.add(request); + responseObserver.onNext(((TestIamPermissionsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method TestIamPermissions, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + TestIamPermissionsResponse.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockTasks.java b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockTasks.java new file mode 100644 index 000000000000..a7389bfc1303 --- /dev/null +++ b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockTasks.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.run.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockTasks implements MockGrpcService { + private final MockTasksImpl serviceImpl; + + public MockTasks() { + serviceImpl = new MockTasksImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockTasksImpl.java b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockTasksImpl.java new file mode 100644 index 000000000000..9eb3d5b44583 --- /dev/null +++ b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/MockTasksImpl.java @@ -0,0 +1,101 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import com.google.api.core.BetaApi; +import com.google.cloud.run.v2.TasksGrpc.TasksImplBase; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockTasksImpl extends TasksImplBase { + private List requests; + private Queue responses; + + public MockTasksImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void getTask(GetTaskRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Task) { + requests.add(request); + responseObserver.onNext(((Task) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetTask, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Task.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listTasks( + ListTasksRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListTasksResponse) { + requests.add(request); + responseObserver.onNext(((ListTasksResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListTasks, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListTasksResponse.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/TasksClientHttpJsonTest.java b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/TasksClientHttpJsonTest.java new file mode 100644 index 000000000000..d62e8ab42d5f --- /dev/null +++ b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/TasksClientHttpJsonTest.java @@ -0,0 +1,330 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import static com.google.cloud.run.v2.TasksClient.ListTasksPagedResponse; + +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.run.v2.stub.HttpJsonTasksStub; +import com.google.common.collect.Lists; +import com.google.protobuf.Duration; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class TasksClientHttpJsonTest { + private static MockHttpService mockService; + private static TasksClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonTasksStub.getMethodDescriptors(), TasksSettings.getDefaultEndpoint()); + TasksSettings settings = + TasksSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + TasksSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = TasksClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void getTaskTest() throws Exception { + Task expectedResponse = + Task.newBuilder() + .setName( + TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setExecution( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .addAllContainers(new ArrayList()) + .addAllVolumes(new ArrayList()) + .setMaxRetries(1129288043) + .setTimeout(Duration.newBuilder().build()) + .setServiceAccount("serviceAccount1079137720") + .setExecutionEnvironment(ExecutionEnvironment.forNumber(0)) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setIndex(100346066) + .setRetried(1098377527) + .setLastAttemptResult(TaskAttemptResult.newBuilder().build()) + .setEncryptionKey("encryptionKey-36224036") + .setVpcAccess(VpcAccess.newBuilder().build()) + .setEtag("etag3123477") + .build(); + mockService.addResponse(expectedResponse); + + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]"); + + Task actualResponse = client.getTask(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 getTaskExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]"); + client.getTask(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getTaskTest2() throws Exception { + Task expectedResponse = + Task.newBuilder() + .setName( + TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setExecution( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .addAllContainers(new ArrayList()) + .addAllVolumes(new ArrayList()) + .setMaxRetries(1129288043) + .setTimeout(Duration.newBuilder().build()) + .setServiceAccount("serviceAccount1079137720") + .setExecutionEnvironment(ExecutionEnvironment.forNumber(0)) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setIndex(100346066) + .setRetried(1098377527) + .setLastAttemptResult(TaskAttemptResult.newBuilder().build()) + .setEncryptionKey("encryptionKey-36224036") + .setVpcAccess(VpcAccess.newBuilder().build()) + .setEtag("etag3123477") + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-119/locations/location-119/jobs/job-119/executions/execution-119/tasks/task-119"; + + Task actualResponse = client.getTask(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 getTaskExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-119/locations/location-119/jobs/job-119/executions/execution-119/tasks/task-119"; + client.getTask(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTasksTest() throws Exception { + Task responsesElement = Task.newBuilder().build(); + ListTasksResponse expectedResponse = + ListTasksResponse.newBuilder() + .setNextPageToken("") + .addAllTasks(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ExecutionName parent = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"); + + ListTasksPagedResponse pagedListResponse = client.listTasks(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTasksList().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 listTasksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ExecutionName parent = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"); + client.listTasks(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTasksTest2() throws Exception { + Task responsesElement = Task.newBuilder().build(); + ListTasksResponse expectedResponse = + ListTasksResponse.newBuilder() + .setNextPageToken("") + .addAllTasks(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = + "projects/project-1154/locations/location-1154/jobs/job-1154/executions/execution-1154"; + + ListTasksPagedResponse pagedListResponse = client.listTasks(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTasksList().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 listTasksExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-1154/locations/location-1154/jobs/job-1154/executions/execution-1154"; + client.listTasks(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/TasksClientTest.java b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/TasksClientTest.java new file mode 100644 index 000000000000..9ea41fda007b --- /dev/null +++ b/java-run/google-cloud-run/src/test/java/com/google/cloud/run/v2/TasksClientTest.java @@ -0,0 +1,308 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import static com.google.cloud.run.v2.TasksClient.ListTasksPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.common.collect.Lists; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Duration; +import com.google.protobuf.Timestamp; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +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 TasksClientTest { + private static MockLocations mockLocations; + private static MockServiceHelper mockServiceHelper; + private static MockTasks mockTasks; + private LocalChannelProvider channelProvider; + private TasksClient client; + + @BeforeClass + public static void startStaticServer() { + mockTasks = new MockTasks(); + mockLocations = new MockLocations(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockTasks, mockLocations)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + TasksSettings settings = + TasksSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = TasksClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void getTaskTest() throws Exception { + Task expectedResponse = + Task.newBuilder() + .setName( + TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setExecution( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .addAllContainers(new ArrayList()) + .addAllVolumes(new ArrayList()) + .setMaxRetries(1129288043) + .setTimeout(Duration.newBuilder().build()) + .setServiceAccount("serviceAccount1079137720") + .setExecutionEnvironment(ExecutionEnvironment.forNumber(0)) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setIndex(100346066) + .setRetried(1098377527) + .setLastAttemptResult(TaskAttemptResult.newBuilder().build()) + .setEncryptionKey("encryptionKey-36224036") + .setVpcAccess(VpcAccess.newBuilder().build()) + .setEtag("etag3123477") + .build(); + mockTasks.addResponse(expectedResponse); + + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]"); + + Task actualResponse = client.getTask(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTasks.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetTaskRequest actualRequest = ((GetTaskRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getTaskExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockTasks.addException(exception); + + try { + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]"); + client.getTask(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getTaskTest2() throws Exception { + Task expectedResponse = + Task.newBuilder() + .setName( + TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]").toString()) + .setUid("uid115792") + .setGeneration(305703192) + .putAllLabels(new HashMap()) + .putAllAnnotations(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setCompletionTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setJob(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setExecution( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .addAllContainers(new ArrayList()) + .addAllVolumes(new ArrayList()) + .setMaxRetries(1129288043) + .setTimeout(Duration.newBuilder().build()) + .setServiceAccount("serviceAccount1079137720") + .setExecutionEnvironment(ExecutionEnvironment.forNumber(0)) + .setReconciling(true) + .addAllConditions(new ArrayList()) + .setObservedGeneration(900833007) + .setIndex(100346066) + .setRetried(1098377527) + .setLastAttemptResult(TaskAttemptResult.newBuilder().build()) + .setEncryptionKey("encryptionKey-36224036") + .setVpcAccess(VpcAccess.newBuilder().build()) + .setEtag("etag3123477") + .build(); + mockTasks.addResponse(expectedResponse); + + String name = "name3373707"; + + Task actualResponse = client.getTask(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockTasks.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetTaskRequest actualRequest = ((GetTaskRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getTaskExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockTasks.addException(exception); + + try { + String name = "name3373707"; + client.getTask(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTasksTest() throws Exception { + Task responsesElement = Task.newBuilder().build(); + ListTasksResponse expectedResponse = + ListTasksResponse.newBuilder() + .setNextPageToken("") + .addAllTasks(Arrays.asList(responsesElement)) + .build(); + mockTasks.addResponse(expectedResponse); + + ExecutionName parent = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"); + + ListTasksPagedResponse pagedListResponse = client.listTasks(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTasksList().get(0), resources.get(0)); + + List actualRequests = mockTasks.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListTasksRequest actualRequest = ((ListTasksRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listTasksExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockTasks.addException(exception); + + try { + ExecutionName parent = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"); + client.listTasks(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTasksTest2() throws Exception { + Task responsesElement = Task.newBuilder().build(); + ListTasksResponse expectedResponse = + ListTasksResponse.newBuilder() + .setNextPageToken("") + .addAllTasks(Arrays.asList(responsesElement)) + .build(); + mockTasks.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListTasksPagedResponse pagedListResponse = client.listTasks(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTasksList().get(0), resources.get(0)); + + List actualRequests = mockTasks.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListTasksRequest actualRequest = ((ListTasksRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listTasksExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockTasks.addException(exception); + + try { + String parent = "parent-995424086"; + client.listTasks(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionsGrpc.java b/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionsGrpc.java new file mode 100644 index 000000000000..d5abff936d55 --- /dev/null +++ b/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionsGrpc.java @@ -0,0 +1,578 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.run.v2; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * Cloud Run Execution Control Plane API.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/run/v2/execution.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class ExecutionsGrpc { + + private ExecutionsGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.run.v2.Executions"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.run.v2.GetExecutionRequest, com.google.cloud.run.v2.Execution> + getGetExecutionMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetExecution", + requestType = com.google.cloud.run.v2.GetExecutionRequest.class, + responseType = com.google.cloud.run.v2.Execution.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.run.v2.GetExecutionRequest, com.google.cloud.run.v2.Execution> + getGetExecutionMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.run.v2.GetExecutionRequest, com.google.cloud.run.v2.Execution> + getGetExecutionMethod; + if ((getGetExecutionMethod = ExecutionsGrpc.getGetExecutionMethod) == null) { + synchronized (ExecutionsGrpc.class) { + if ((getGetExecutionMethod = ExecutionsGrpc.getGetExecutionMethod) == null) { + ExecutionsGrpc.getGetExecutionMethod = + getGetExecutionMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetExecution")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.GetExecutionRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.Execution.getDefaultInstance())) + .setSchemaDescriptor(new ExecutionsMethodDescriptorSupplier("GetExecution")) + .build(); + } + } + } + return getGetExecutionMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.run.v2.ListExecutionsRequest, + com.google.cloud.run.v2.ListExecutionsResponse> + getListExecutionsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListExecutions", + requestType = com.google.cloud.run.v2.ListExecutionsRequest.class, + responseType = com.google.cloud.run.v2.ListExecutionsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.run.v2.ListExecutionsRequest, + com.google.cloud.run.v2.ListExecutionsResponse> + getListExecutionsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.run.v2.ListExecutionsRequest, + com.google.cloud.run.v2.ListExecutionsResponse> + getListExecutionsMethod; + if ((getListExecutionsMethod = ExecutionsGrpc.getListExecutionsMethod) == null) { + synchronized (ExecutionsGrpc.class) { + if ((getListExecutionsMethod = ExecutionsGrpc.getListExecutionsMethod) == null) { + ExecutionsGrpc.getListExecutionsMethod = + getListExecutionsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListExecutions")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.ListExecutionsRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.ListExecutionsResponse.getDefaultInstance())) + .setSchemaDescriptor(new ExecutionsMethodDescriptorSupplier("ListExecutions")) + .build(); + } + } + } + return getListExecutionsMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.run.v2.DeleteExecutionRequest, com.google.longrunning.Operation> + getDeleteExecutionMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteExecution", + requestType = com.google.cloud.run.v2.DeleteExecutionRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.run.v2.DeleteExecutionRequest, com.google.longrunning.Operation> + getDeleteExecutionMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.run.v2.DeleteExecutionRequest, com.google.longrunning.Operation> + getDeleteExecutionMethod; + if ((getDeleteExecutionMethod = ExecutionsGrpc.getDeleteExecutionMethod) == null) { + synchronized (ExecutionsGrpc.class) { + if ((getDeleteExecutionMethod = ExecutionsGrpc.getDeleteExecutionMethod) == null) { + ExecutionsGrpc.getDeleteExecutionMethod = + getDeleteExecutionMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteExecution")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.DeleteExecutionRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new ExecutionsMethodDescriptorSupplier("DeleteExecution")) + .build(); + } + } + } + return getDeleteExecutionMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static ExecutionsStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ExecutionsStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ExecutionsStub(channel, callOptions); + } + }; + return ExecutionsStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static ExecutionsBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ExecutionsBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ExecutionsBlockingStub(channel, callOptions); + } + }; + return ExecutionsBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static ExecutionsFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ExecutionsFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ExecutionsFutureStub(channel, callOptions); + } + }; + return ExecutionsFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Cloud Run Execution Control Plane API.
+   * 
+ */ + public abstract static class ExecutionsImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Gets information about an Execution.
+     * 
+ */ + public void getExecution( + com.google.cloud.run.v2.GetExecutionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetExecutionMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists Executions from a Job.
+     * 
+ */ + public void listExecutions( + com.google.cloud.run.v2.ListExecutionsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListExecutionsMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes an Execution.
+     * 
+ */ + public void deleteExecution( + com.google.cloud.run.v2.DeleteExecutionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteExecutionMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getGetExecutionMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.run.v2.GetExecutionRequest, + com.google.cloud.run.v2.Execution>(this, METHODID_GET_EXECUTION))) + .addMethod( + getListExecutionsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.run.v2.ListExecutionsRequest, + com.google.cloud.run.v2.ListExecutionsResponse>( + this, METHODID_LIST_EXECUTIONS))) + .addMethod( + getDeleteExecutionMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.run.v2.DeleteExecutionRequest, + com.google.longrunning.Operation>(this, METHODID_DELETE_EXECUTION))) + .build(); + } + } + + /** + * + * + *
+   * Cloud Run Execution Control Plane API.
+   * 
+ */ + public static final class ExecutionsStub extends io.grpc.stub.AbstractAsyncStub { + private ExecutionsStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ExecutionsStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ExecutionsStub(channel, callOptions); + } + + /** + * + * + *
+     * Gets information about an Execution.
+     * 
+ */ + public void getExecution( + com.google.cloud.run.v2.GetExecutionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetExecutionMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Lists Executions from a Job.
+     * 
+ */ + public void listExecutions( + com.google.cloud.run.v2.ListExecutionsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListExecutionsMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes an Execution.
+     * 
+ */ + public void deleteExecution( + com.google.cloud.run.v2.DeleteExecutionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteExecutionMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Cloud Run Execution Control Plane API.
+   * 
+ */ + public static final class ExecutionsBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private ExecutionsBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ExecutionsBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ExecutionsBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Gets information about an Execution.
+     * 
+ */ + public com.google.cloud.run.v2.Execution getExecution( + com.google.cloud.run.v2.GetExecutionRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetExecutionMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists Executions from a Job.
+     * 
+ */ + public com.google.cloud.run.v2.ListExecutionsResponse listExecutions( + com.google.cloud.run.v2.ListExecutionsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListExecutionsMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes an Execution.
+     * 
+ */ + public com.google.longrunning.Operation deleteExecution( + com.google.cloud.run.v2.DeleteExecutionRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteExecutionMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Cloud Run Execution Control Plane API.
+   * 
+ */ + public static final class ExecutionsFutureStub + extends io.grpc.stub.AbstractFutureStub { + private ExecutionsFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ExecutionsFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ExecutionsFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Gets information about an Execution.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + getExecution(com.google.cloud.run.v2.GetExecutionRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetExecutionMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists Executions from a Job.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.run.v2.ListExecutionsResponse> + listExecutions(com.google.cloud.run.v2.ListExecutionsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListExecutionsMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes an Execution.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteExecution(com.google.cloud.run.v2.DeleteExecutionRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteExecutionMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_GET_EXECUTION = 0; + private static final int METHODID_LIST_EXECUTIONS = 1; + private static final int METHODID_DELETE_EXECUTION = 2; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final ExecutionsImplBase serviceImpl; + private final int methodId; + + MethodHandlers(ExecutionsImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_GET_EXECUTION: + serviceImpl.getExecution( + (com.google.cloud.run.v2.GetExecutionRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_EXECUTIONS: + serviceImpl.listExecutions( + (com.google.cloud.run.v2.ListExecutionsRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_DELETE_EXECUTION: + serviceImpl.deleteExecution( + (com.google.cloud.run.v2.DeleteExecutionRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class ExecutionsBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + ExecutionsBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.run.v2.ExecutionProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("Executions"); + } + } + + private static final class ExecutionsFileDescriptorSupplier + extends ExecutionsBaseDescriptorSupplier { + ExecutionsFileDescriptorSupplier() {} + } + + private static final class ExecutionsMethodDescriptorSupplier + extends ExecutionsBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + ExecutionsMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (ExecutionsGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new ExecutionsFileDescriptorSupplier()) + .addMethod(getGetExecutionMethod()) + .addMethod(getListExecutionsMethod()) + .addMethod(getDeleteExecutionMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobsGrpc.java b/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobsGrpc.java new file mode 100644 index 000000000000..9a063c6e1e50 --- /dev/null +++ b/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobsGrpc.java @@ -0,0 +1,1210 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.run.v2; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * Cloud Run Job Control Plane API.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/run/v2/job.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class JobsGrpc { + + private JobsGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.run.v2.Jobs"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.run.v2.CreateJobRequest, com.google.longrunning.Operation> + getCreateJobMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateJob", + requestType = com.google.cloud.run.v2.CreateJobRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.run.v2.CreateJobRequest, com.google.longrunning.Operation> + getCreateJobMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.run.v2.CreateJobRequest, com.google.longrunning.Operation> + getCreateJobMethod; + if ((getCreateJobMethod = JobsGrpc.getCreateJobMethod) == null) { + synchronized (JobsGrpc.class) { + if ((getCreateJobMethod = JobsGrpc.getCreateJobMethod) == null) { + JobsGrpc.getCreateJobMethod = + getCreateJobMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateJob")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.CreateJobRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new JobsMethodDescriptorSupplier("CreateJob")) + .build(); + } + } + } + return getCreateJobMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.run.v2.GetJobRequest, com.google.cloud.run.v2.Job> + getGetJobMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetJob", + requestType = com.google.cloud.run.v2.GetJobRequest.class, + responseType = com.google.cloud.run.v2.Job.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.run.v2.GetJobRequest, com.google.cloud.run.v2.Job> + getGetJobMethod() { + io.grpc.MethodDescriptor + getGetJobMethod; + if ((getGetJobMethod = JobsGrpc.getGetJobMethod) == null) { + synchronized (JobsGrpc.class) { + if ((getGetJobMethod = JobsGrpc.getGetJobMethod) == null) { + JobsGrpc.getGetJobMethod = + getGetJobMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetJob")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.GetJobRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.Job.getDefaultInstance())) + .setSchemaDescriptor(new JobsMethodDescriptorSupplier("GetJob")) + .build(); + } + } + } + return getGetJobMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.run.v2.ListJobsRequest, com.google.cloud.run.v2.ListJobsResponse> + getListJobsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListJobs", + requestType = com.google.cloud.run.v2.ListJobsRequest.class, + responseType = com.google.cloud.run.v2.ListJobsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.run.v2.ListJobsRequest, com.google.cloud.run.v2.ListJobsResponse> + getListJobsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.run.v2.ListJobsRequest, com.google.cloud.run.v2.ListJobsResponse> + getListJobsMethod; + if ((getListJobsMethod = JobsGrpc.getListJobsMethod) == null) { + synchronized (JobsGrpc.class) { + if ((getListJobsMethod = JobsGrpc.getListJobsMethod) == null) { + JobsGrpc.getListJobsMethod = + getListJobsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListJobs")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.ListJobsRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.ListJobsResponse.getDefaultInstance())) + .setSchemaDescriptor(new JobsMethodDescriptorSupplier("ListJobs")) + .build(); + } + } + } + return getListJobsMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.run.v2.UpdateJobRequest, com.google.longrunning.Operation> + getUpdateJobMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateJob", + requestType = com.google.cloud.run.v2.UpdateJobRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.run.v2.UpdateJobRequest, com.google.longrunning.Operation> + getUpdateJobMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.run.v2.UpdateJobRequest, com.google.longrunning.Operation> + getUpdateJobMethod; + if ((getUpdateJobMethod = JobsGrpc.getUpdateJobMethod) == null) { + synchronized (JobsGrpc.class) { + if ((getUpdateJobMethod = JobsGrpc.getUpdateJobMethod) == null) { + JobsGrpc.getUpdateJobMethod = + getUpdateJobMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateJob")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.UpdateJobRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new JobsMethodDescriptorSupplier("UpdateJob")) + .build(); + } + } + } + return getUpdateJobMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.run.v2.DeleteJobRequest, com.google.longrunning.Operation> + getDeleteJobMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteJob", + requestType = com.google.cloud.run.v2.DeleteJobRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.run.v2.DeleteJobRequest, com.google.longrunning.Operation> + getDeleteJobMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.run.v2.DeleteJobRequest, com.google.longrunning.Operation> + getDeleteJobMethod; + if ((getDeleteJobMethod = JobsGrpc.getDeleteJobMethod) == null) { + synchronized (JobsGrpc.class) { + if ((getDeleteJobMethod = JobsGrpc.getDeleteJobMethod) == null) { + JobsGrpc.getDeleteJobMethod = + getDeleteJobMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteJob")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.DeleteJobRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new JobsMethodDescriptorSupplier("DeleteJob")) + .build(); + } + } + } + return getDeleteJobMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.run.v2.RunJobRequest, com.google.longrunning.Operation> + getRunJobMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "RunJob", + requestType = com.google.cloud.run.v2.RunJobRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.run.v2.RunJobRequest, com.google.longrunning.Operation> + getRunJobMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.run.v2.RunJobRequest, com.google.longrunning.Operation> + getRunJobMethod; + if ((getRunJobMethod = JobsGrpc.getRunJobMethod) == null) { + synchronized (JobsGrpc.class) { + if ((getRunJobMethod = JobsGrpc.getRunJobMethod) == null) { + JobsGrpc.getRunJobMethod = + getRunJobMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "RunJob")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.RunJobRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new JobsMethodDescriptorSupplier("RunJob")) + .build(); + } + } + } + return getRunJobMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy> + getGetIamPolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetIamPolicy", + requestType = com.google.iam.v1.GetIamPolicyRequest.class, + responseType = com.google.iam.v1.Policy.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy> + getGetIamPolicyMethod() { + io.grpc.MethodDescriptor + getGetIamPolicyMethod; + if ((getGetIamPolicyMethod = JobsGrpc.getGetIamPolicyMethod) == null) { + synchronized (JobsGrpc.class) { + if ((getGetIamPolicyMethod = JobsGrpc.getGetIamPolicyMethod) == null) { + JobsGrpc.getGetIamPolicyMethod = + getGetIamPolicyMethod = + io.grpc.MethodDescriptor + .newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetIamPolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.GetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.Policy.getDefaultInstance())) + .setSchemaDescriptor(new JobsMethodDescriptorSupplier("GetIamPolicy")) + .build(); + } + } + } + return getGetIamPolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy> + getSetIamPolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "SetIamPolicy", + requestType = com.google.iam.v1.SetIamPolicyRequest.class, + responseType = com.google.iam.v1.Policy.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy> + getSetIamPolicyMethod() { + io.grpc.MethodDescriptor + getSetIamPolicyMethod; + if ((getSetIamPolicyMethod = JobsGrpc.getSetIamPolicyMethod) == null) { + synchronized (JobsGrpc.class) { + if ((getSetIamPolicyMethod = JobsGrpc.getSetIamPolicyMethod) == null) { + JobsGrpc.getSetIamPolicyMethod = + getSetIamPolicyMethod = + io.grpc.MethodDescriptor + .newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SetIamPolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.SetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.Policy.getDefaultInstance())) + .setSchemaDescriptor(new JobsMethodDescriptorSupplier("SetIamPolicy")) + .build(); + } + } + } + return getSetIamPolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v1.TestIamPermissionsRequest, com.google.iam.v1.TestIamPermissionsResponse> + getTestIamPermissionsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "TestIamPermissions", + requestType = com.google.iam.v1.TestIamPermissionsRequest.class, + responseType = com.google.iam.v1.TestIamPermissionsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v1.TestIamPermissionsRequest, com.google.iam.v1.TestIamPermissionsResponse> + getTestIamPermissionsMethod() { + io.grpc.MethodDescriptor< + com.google.iam.v1.TestIamPermissionsRequest, + com.google.iam.v1.TestIamPermissionsResponse> + getTestIamPermissionsMethod; + if ((getTestIamPermissionsMethod = JobsGrpc.getTestIamPermissionsMethod) == null) { + synchronized (JobsGrpc.class) { + if ((getTestIamPermissionsMethod = JobsGrpc.getTestIamPermissionsMethod) == null) { + JobsGrpc.getTestIamPermissionsMethod = + getTestIamPermissionsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "TestIamPermissions")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.TestIamPermissionsRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.TestIamPermissionsResponse.getDefaultInstance())) + .setSchemaDescriptor(new JobsMethodDescriptorSupplier("TestIamPermissions")) + .build(); + } + } + } + return getTestIamPermissionsMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static JobsStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public JobsStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new JobsStub(channel, callOptions); + } + }; + return JobsStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static JobsBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public JobsBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new JobsBlockingStub(channel, callOptions); + } + }; + return JobsBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static JobsFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public JobsFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new JobsFutureStub(channel, callOptions); + } + }; + return JobsFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Cloud Run Job Control Plane API.
+   * 
+ */ + public abstract static class JobsImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Creates a Job.
+     * 
+ */ + public void createJob( + com.google.cloud.run.v2.CreateJobRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getCreateJobMethod(), responseObserver); + } + + /** + * + * + *
+     * Gets information about a Job.
+     * 
+ */ + public void getJob( + com.google.cloud.run.v2.GetJobRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetJobMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists Jobs.
+     * 
+ */ + public void listJobs( + com.google.cloud.run.v2.ListJobsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getListJobsMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates a Job.
+     * 
+ */ + public void updateJob( + com.google.cloud.run.v2.UpdateJobRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getUpdateJobMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes a Job.
+     * 
+ */ + public void deleteJob( + com.google.cloud.run.v2.DeleteJobRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getDeleteJobMethod(), responseObserver); + } + + /** + * + * + *
+     * Triggers creation of a new Execution of this Job.
+     * 
+ */ + public void runJob( + com.google.cloud.run.v2.RunJobRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getRunJobMethod(), responseObserver); + } + + /** + * + * + *
+     * Get the IAM Access Control policy currently in effect for the given Job.
+     * This result does not include any inherited policies.
+     * 
+ */ + public void getIamPolicy( + com.google.iam.v1.GetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetIamPolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Sets the IAM Access control policy for the specified Job. Overwrites
+     * any existing policy.
+     * 
+ */ + public void setIamPolicy( + com.google.iam.v1.SetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getSetIamPolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Returns permissions that a caller has on the specified Project.
+     * There are no permissions required for making this API call.
+     * 
+ */ + public void testIamPermissions( + com.google.iam.v1.TestIamPermissionsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getTestIamPermissionsMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCreateJobMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.run.v2.CreateJobRequest, com.google.longrunning.Operation>( + this, METHODID_CREATE_JOB))) + .addMethod( + getGetJobMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.run.v2.GetJobRequest, com.google.cloud.run.v2.Job>( + this, METHODID_GET_JOB))) + .addMethod( + getListJobsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.run.v2.ListJobsRequest, + com.google.cloud.run.v2.ListJobsResponse>(this, METHODID_LIST_JOBS))) + .addMethod( + getUpdateJobMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.run.v2.UpdateJobRequest, com.google.longrunning.Operation>( + this, METHODID_UPDATE_JOB))) + .addMethod( + getDeleteJobMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.run.v2.DeleteJobRequest, com.google.longrunning.Operation>( + this, METHODID_DELETE_JOB))) + .addMethod( + getRunJobMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.run.v2.RunJobRequest, com.google.longrunning.Operation>( + this, METHODID_RUN_JOB))) + .addMethod( + getGetIamPolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy>( + this, METHODID_GET_IAM_POLICY))) + .addMethod( + getSetIamPolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy>( + this, METHODID_SET_IAM_POLICY))) + .addMethod( + getTestIamPermissionsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v1.TestIamPermissionsRequest, + com.google.iam.v1.TestIamPermissionsResponse>( + this, METHODID_TEST_IAM_PERMISSIONS))) + .build(); + } + } + + /** + * + * + *
+   * Cloud Run Job Control Plane API.
+   * 
+ */ + public static final class JobsStub extends io.grpc.stub.AbstractAsyncStub { + private JobsStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected JobsStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new JobsStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a Job.
+     * 
+ */ + public void createJob( + com.google.cloud.run.v2.CreateJobRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateJobMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Gets information about a Job.
+     * 
+ */ + public void getJob( + com.google.cloud.run.v2.GetJobRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetJobMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Lists Jobs.
+     * 
+ */ + public void listJobs( + com.google.cloud.run.v2.ListJobsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListJobsMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Updates a Job.
+     * 
+ */ + public void updateJob( + com.google.cloud.run.v2.UpdateJobRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdateJobMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Deletes a Job.
+     * 
+ */ + public void deleteJob( + com.google.cloud.run.v2.DeleteJobRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteJobMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Triggers creation of a new Execution of this Job.
+     * 
+ */ + public void runJob( + com.google.cloud.run.v2.RunJobRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getRunJobMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Get the IAM Access Control policy currently in effect for the given Job.
+     * This result does not include any inherited policies.
+     * 
+ */ + public void getIamPolicy( + com.google.iam.v1.GetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetIamPolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Sets the IAM Access control policy for the specified Job. Overwrites
+     * any existing policy.
+     * 
+ */ + public void setIamPolicy( + com.google.iam.v1.SetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getSetIamPolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Returns permissions that a caller has on the specified Project.
+     * There are no permissions required for making this API call.
+     * 
+ */ + public void testIamPermissions( + com.google.iam.v1.TestIamPermissionsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getTestIamPermissionsMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Cloud Run Job Control Plane API.
+   * 
+ */ + public static final class JobsBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private JobsBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected JobsBlockingStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new JobsBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a Job.
+     * 
+ */ + public com.google.longrunning.Operation createJob( + com.google.cloud.run.v2.CreateJobRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateJobMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets information about a Job.
+     * 
+ */ + public com.google.cloud.run.v2.Job getJob(com.google.cloud.run.v2.GetJobRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetJobMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists Jobs.
+     * 
+ */ + public com.google.cloud.run.v2.ListJobsResponse listJobs( + com.google.cloud.run.v2.ListJobsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListJobsMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates a Job.
+     * 
+ */ + public com.google.longrunning.Operation updateJob( + com.google.cloud.run.v2.UpdateJobRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateJobMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes a Job.
+     * 
+ */ + public com.google.longrunning.Operation deleteJob( + com.google.cloud.run.v2.DeleteJobRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteJobMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Triggers creation of a new Execution of this Job.
+     * 
+ */ + public com.google.longrunning.Operation runJob(com.google.cloud.run.v2.RunJobRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getRunJobMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Get the IAM Access Control policy currently in effect for the given Job.
+     * This result does not include any inherited policies.
+     * 
+ */ + public com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetIamPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Sets the IAM Access control policy for the specified Job. Overwrites
+     * any existing policy.
+     * 
+ */ + public com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getSetIamPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Returns permissions that a caller has on the specified Project.
+     * There are no permissions required for making this API call.
+     * 
+ */ + public com.google.iam.v1.TestIamPermissionsResponse testIamPermissions( + com.google.iam.v1.TestIamPermissionsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getTestIamPermissionsMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Cloud Run Job Control Plane API.
+   * 
+ */ + public static final class JobsFutureStub extends io.grpc.stub.AbstractFutureStub { + private JobsFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected JobsFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new JobsFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a Job.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + createJob(com.google.cloud.run.v2.CreateJobRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateJobMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Gets information about a Job.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getJob( + com.google.cloud.run.v2.GetJobRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetJobMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists Jobs.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.run.v2.ListJobsResponse> + listJobs(com.google.cloud.run.v2.ListJobsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListJobsMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates a Job.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + updateJob(com.google.cloud.run.v2.UpdateJobRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateJobMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes a Job.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteJob(com.google.cloud.run.v2.DeleteJobRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteJobMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Triggers creation of a new Execution of this Job.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + runJob(com.google.cloud.run.v2.RunJobRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getRunJobMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Get the IAM Access Control policy currently in effect for the given Job.
+     * This result does not include any inherited policies.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetIamPolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Sets the IAM Access control policy for the specified Job. Overwrites
+     * any existing policy.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getSetIamPolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Returns permissions that a caller has on the specified Project.
+     * There are no permissions required for making this API call.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.iam.v1.TestIamPermissionsResponse> + testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getTestIamPermissionsMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_CREATE_JOB = 0; + private static final int METHODID_GET_JOB = 1; + private static final int METHODID_LIST_JOBS = 2; + private static final int METHODID_UPDATE_JOB = 3; + private static final int METHODID_DELETE_JOB = 4; + private static final int METHODID_RUN_JOB = 5; + private static final int METHODID_GET_IAM_POLICY = 6; + private static final int METHODID_SET_IAM_POLICY = 7; + private static final int METHODID_TEST_IAM_PERMISSIONS = 8; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final JobsImplBase serviceImpl; + private final int methodId; + + MethodHandlers(JobsImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_CREATE_JOB: + serviceImpl.createJob( + (com.google.cloud.run.v2.CreateJobRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_JOB: + serviceImpl.getJob( + (com.google.cloud.run.v2.GetJobRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_JOBS: + serviceImpl.listJobs( + (com.google.cloud.run.v2.ListJobsRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_UPDATE_JOB: + serviceImpl.updateJob( + (com.google.cloud.run.v2.UpdateJobRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_JOB: + serviceImpl.deleteJob( + (com.google.cloud.run.v2.DeleteJobRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_RUN_JOB: + serviceImpl.runJob( + (com.google.cloud.run.v2.RunJobRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_IAM_POLICY: + serviceImpl.getIamPolicy( + (com.google.iam.v1.GetIamPolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_SET_IAM_POLICY: + serviceImpl.setIamPolicy( + (com.google.iam.v1.SetIamPolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_TEST_IAM_PERMISSIONS: + serviceImpl.testIamPermissions( + (com.google.iam.v1.TestIamPermissionsRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class JobsBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + JobsBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.run.v2.JobProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("Jobs"); + } + } + + private static final class JobsFileDescriptorSupplier extends JobsBaseDescriptorSupplier { + JobsFileDescriptorSupplier() {} + } + + private static final class JobsMethodDescriptorSupplier extends JobsBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + JobsMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (JobsGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new JobsFileDescriptorSupplier()) + .addMethod(getCreateJobMethod()) + .addMethod(getGetJobMethod()) + .addMethod(getListJobsMethod()) + .addMethod(getUpdateJobMethod()) + .addMethod(getDeleteJobMethod()) + .addMethod(getRunJobMethod()) + .addMethod(getGetIamPolicyMethod()) + .addMethod(getSetIamPolicyMethod()) + .addMethod(getTestIamPermissionsMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/RevisionsGrpc.java b/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/RevisionsGrpc.java index 287d926d2a1b..3ec9db513ad2 100644 --- a/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/RevisionsGrpc.java +++ b/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/RevisionsGrpc.java @@ -228,7 +228,7 @@ public void getRevision( * * *
-     * List Revisions from a given Service, or from a given location.
+     * Lists Revisions from a given Service, or from a given location.
      * 
*/ public void listRevisions( @@ -243,7 +243,7 @@ public void listRevisions( * * *
-     * Delete a Revision.
+     * Deletes a Revision.
      * 
*/ public void deleteRevision( @@ -316,7 +316,7 @@ public void getRevision( * * *
-     * List Revisions from a given Service, or from a given location.
+     * Lists Revisions from a given Service, or from a given location.
      * 
*/ public void listRevisions( @@ -333,7 +333,7 @@ public void listRevisions( * * *
-     * Delete a Revision.
+     * Deletes a Revision.
      * 
*/ public void deleteRevision( @@ -382,7 +382,7 @@ public com.google.cloud.run.v2.Revision getRevision( * * *
-     * List Revisions from a given Service, or from a given location.
+     * Lists Revisions from a given Service, or from a given location.
      * 
*/ public com.google.cloud.run.v2.ListRevisionsResponse listRevisions( @@ -395,7 +395,7 @@ public com.google.cloud.run.v2.ListRevisionsResponse listRevisions( * * *
-     * Delete a Revision.
+     * Deletes a Revision.
      * 
*/ public com.google.longrunning.Operation deleteRevision( @@ -440,7 +440,7 @@ protected RevisionsFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions * * *
-     * List Revisions from a given Service, or from a given location.
+     * Lists Revisions from a given Service, or from a given location.
      * 
*/ public com.google.common.util.concurrent.ListenableFuture< @@ -454,7 +454,7 @@ protected RevisionsFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions * * *
-     * Delete a Revision.
+     * Deletes a Revision.
      * 
*/ public com.google.common.util.concurrent.ListenableFuture diff --git a/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ServicesGrpc.java b/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ServicesGrpc.java index fe875c8c05fb..bc72f040eb36 100644 --- a/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ServicesGrpc.java +++ b/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ServicesGrpc.java @@ -439,7 +439,7 @@ public void getService( * * *
-     * List Services.
+     * Lists Services.
      * 
*/ public void listServices( @@ -484,7 +484,7 @@ public void deleteService( * * *
-     * Get the IAM Access Control policy currently in effect for the given
+     * Gets the IAM Access Control policy currently in effect for the given
      * Cloud Run Service. This result does not include any inherited policies.
      * 
*/ @@ -633,7 +633,7 @@ public void getService( * * *
-     * List Services.
+     * Lists Services.
      * 
*/ public void listServices( @@ -684,7 +684,7 @@ public void deleteService( * * *
-     * Get the IAM Access Control policy currently in effect for the given
+     * Gets the IAM Access Control policy currently in effect for the given
      * Cloud Run Service. This result does not include any inherited policies.
      * 
*/ @@ -781,7 +781,7 @@ public com.google.cloud.run.v2.Service getService( * * *
-     * List Services.
+     * Lists Services.
      * 
*/ public com.google.cloud.run.v2.ListServicesResponse listServices( @@ -822,7 +822,7 @@ public com.google.longrunning.Operation deleteService( * * *
-     * Get the IAM Access Control policy currently in effect for the given
+     * Gets the IAM Access Control policy currently in effect for the given
      * Cloud Run Service. This result does not include any inherited policies.
      * 
*/ @@ -907,7 +907,7 @@ protected ServicesFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions * * *
-     * List Services.
+     * Lists Services.
      * 
*/ public com.google.common.util.concurrent.ListenableFuture< @@ -949,7 +949,7 @@ protected ServicesFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions * * *
-     * Get the IAM Access Control policy currently in effect for the given
+     * Gets the IAM Access Control policy currently in effect for the given
      * Cloud Run Service. This result does not include any inherited policies.
      * 
*/ diff --git a/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TasksGrpc.java b/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TasksGrpc.java new file mode 100644 index 000000000000..b9d31faa669d --- /dev/null +++ b/java-run/grpc-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TasksGrpc.java @@ -0,0 +1,448 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.run.v2; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * Cloud Run Task Control Plane API.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/run/v2/task.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class TasksGrpc { + + private TasksGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.run.v2.Tasks"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.run.v2.GetTaskRequest, com.google.cloud.run.v2.Task> + getGetTaskMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetTask", + requestType = com.google.cloud.run.v2.GetTaskRequest.class, + responseType = com.google.cloud.run.v2.Task.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.run.v2.GetTaskRequest, com.google.cloud.run.v2.Task> + getGetTaskMethod() { + io.grpc.MethodDescriptor + getGetTaskMethod; + if ((getGetTaskMethod = TasksGrpc.getGetTaskMethod) == null) { + synchronized (TasksGrpc.class) { + if ((getGetTaskMethod = TasksGrpc.getGetTaskMethod) == null) { + TasksGrpc.getGetTaskMethod = + getGetTaskMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetTask")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.GetTaskRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.Task.getDefaultInstance())) + .setSchemaDescriptor(new TasksMethodDescriptorSupplier("GetTask")) + .build(); + } + } + } + return getGetTaskMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.run.v2.ListTasksRequest, com.google.cloud.run.v2.ListTasksResponse> + getListTasksMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListTasks", + requestType = com.google.cloud.run.v2.ListTasksRequest.class, + responseType = com.google.cloud.run.v2.ListTasksResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.run.v2.ListTasksRequest, com.google.cloud.run.v2.ListTasksResponse> + getListTasksMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.run.v2.ListTasksRequest, com.google.cloud.run.v2.ListTasksResponse> + getListTasksMethod; + if ((getListTasksMethod = TasksGrpc.getListTasksMethod) == null) { + synchronized (TasksGrpc.class) { + if ((getListTasksMethod = TasksGrpc.getListTasksMethod) == null) { + TasksGrpc.getListTasksMethod = + getListTasksMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListTasks")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.ListTasksRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.run.v2.ListTasksResponse.getDefaultInstance())) + .setSchemaDescriptor(new TasksMethodDescriptorSupplier("ListTasks")) + .build(); + } + } + } + return getListTasksMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static TasksStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public TasksStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new TasksStub(channel, callOptions); + } + }; + return TasksStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static TasksBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public TasksBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new TasksBlockingStub(channel, callOptions); + } + }; + return TasksBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static TasksFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public TasksFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new TasksFutureStub(channel, callOptions); + } + }; + return TasksFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Cloud Run Task Control Plane API.
+   * 
+ */ + public abstract static class TasksImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Gets information about a Task.
+     * 
+ */ + public void getTask( + com.google.cloud.run.v2.GetTaskRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetTaskMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists Tasks from an Execution of a Job.
+     * 
+ */ + public void listTasks( + com.google.cloud.run.v2.ListTasksRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getListTasksMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getGetTaskMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.run.v2.GetTaskRequest, com.google.cloud.run.v2.Task>( + this, METHODID_GET_TASK))) + .addMethod( + getListTasksMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.run.v2.ListTasksRequest, + com.google.cloud.run.v2.ListTasksResponse>(this, METHODID_LIST_TASKS))) + .build(); + } + } + + /** + * + * + *
+   * Cloud Run Task Control Plane API.
+   * 
+ */ + public static final class TasksStub extends io.grpc.stub.AbstractAsyncStub { + private TasksStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected TasksStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new TasksStub(channel, callOptions); + } + + /** + * + * + *
+     * Gets information about a Task.
+     * 
+ */ + public void getTask( + com.google.cloud.run.v2.GetTaskRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetTaskMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Lists Tasks from an Execution of a Job.
+     * 
+ */ + public void listTasks( + com.google.cloud.run.v2.ListTasksRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListTasksMethod(), getCallOptions()), request, responseObserver); + } + } + + /** + * + * + *
+   * Cloud Run Task Control Plane API.
+   * 
+ */ + public static final class TasksBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private TasksBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected TasksBlockingStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new TasksBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Gets information about a Task.
+     * 
+ */ + public com.google.cloud.run.v2.Task getTask(com.google.cloud.run.v2.GetTaskRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetTaskMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists Tasks from an Execution of a Job.
+     * 
+ */ + public com.google.cloud.run.v2.ListTasksResponse listTasks( + com.google.cloud.run.v2.ListTasksRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListTasksMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Cloud Run Task Control Plane API.
+   * 
+ */ + public static final class TasksFutureStub + extends io.grpc.stub.AbstractFutureStub { + private TasksFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected TasksFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new TasksFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Gets information about a Task.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getTask( + com.google.cloud.run.v2.GetTaskRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetTaskMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists Tasks from an Execution of a Job.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.run.v2.ListTasksResponse> + listTasks(com.google.cloud.run.v2.ListTasksRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListTasksMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_GET_TASK = 0; + private static final int METHODID_LIST_TASKS = 1; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final TasksImplBase serviceImpl; + private final int methodId; + + MethodHandlers(TasksImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_GET_TASK: + serviceImpl.getTask( + (com.google.cloud.run.v2.GetTaskRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_TASKS: + serviceImpl.listTasks( + (com.google.cloud.run.v2.ListTasksRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class TasksBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + TasksBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.run.v2.TaskProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("Tasks"); + } + } + + private static final class TasksFileDescriptorSupplier extends TasksBaseDescriptorSupplier { + TasksFileDescriptorSupplier() {} + } + + private static final class TasksMethodDescriptorSupplier extends TasksBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + TasksMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (TasksGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new TasksFileDescriptorSupplier()) + .addMethod(getGetTaskMethod()) + .addMethod(getListTasksMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateJobRequest.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateJobRequest.java new file mode 100644 index 000000000000..60fc6a38bd5b --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateJobRequest.java @@ -0,0 +1,1171 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Request message for creating a Job.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.CreateJobRequest} + */ +public final class CreateJobRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.CreateJobRequest) + CreateJobRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateJobRequest.newBuilder() to construct. + private CreateJobRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateJobRequest() { + parent_ = ""; + jobId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateJobRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_CreateJobRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_CreateJobRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.CreateJobRequest.class, + com.google.cloud.run.v2.CreateJobRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The location and project in which this Job should be created.
+   * Format: projects/{project}/locations/{location}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The location and project in which this Job should be created.
+   * Format: projects/{project}/locations/{location}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int JOB_FIELD_NUMBER = 2; + private com.google.cloud.run.v2.Job job_; + /** + * + * + *
+   * Required. The Job instance to create.
+   * 
+ * + * .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the job field is set. + */ + @java.lang.Override + public boolean hasJob() { + return job_ != null; + } + /** + * + * + *
+   * Required. The Job instance to create.
+   * 
+ * + * .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The job. + */ + @java.lang.Override + public com.google.cloud.run.v2.Job getJob() { + return job_ == null ? com.google.cloud.run.v2.Job.getDefaultInstance() : job_; + } + /** + * + * + *
+   * Required. The Job instance to create.
+   * 
+ * + * .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.cloud.run.v2.JobOrBuilder getJobOrBuilder() { + return getJob(); + } + + public static final int JOB_ID_FIELD_NUMBER = 3; + private volatile java.lang.Object jobId_; + /** + * + * + *
+   * Required. The unique identifier for the Job. The name of the job becomes
+   * {parent}/jobs/{job_id}.
+   * 
+ * + * string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The jobId. + */ + @java.lang.Override + public java.lang.String getJobId() { + java.lang.Object ref = jobId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + jobId_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The unique identifier for the Job. The name of the job becomes
+   * {parent}/jobs/{job_id}.
+   * 
+ * + * string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for jobId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getJobIdBytes() { + java.lang.Object ref = jobId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + jobId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 4; + private boolean validateOnly_; + /** + * + * + *
+   * Indicates that the request should be validated and default values
+   * populated, without persisting the request or creating any resources.
+   * 
+ * + * bool validate_only = 4; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (job_ != null) { + output.writeMessage(2, getJob()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(jobId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, jobId_); + } + if (validateOnly_ != false) { + output.writeBool(4, validateOnly_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (job_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getJob()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(jobId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, jobId_); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, validateOnly_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.CreateJobRequest)) { + return super.equals(obj); + } + com.google.cloud.run.v2.CreateJobRequest other = (com.google.cloud.run.v2.CreateJobRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasJob() != other.hasJob()) return false; + if (hasJob()) { + if (!getJob().equals(other.getJob())) return false; + } + if (!getJobId().equals(other.getJobId())) return false; + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasJob()) { + hash = (37 * hash) + JOB_FIELD_NUMBER; + hash = (53 * hash) + getJob().hashCode(); + } + hash = (37 * hash) + JOB_ID_FIELD_NUMBER; + hash = (53 * hash) + getJobId().hashCode(); + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.CreateJobRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.CreateJobRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.CreateJobRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.CreateJobRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.CreateJobRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.CreateJobRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.CreateJobRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.CreateJobRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.CreateJobRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.CreateJobRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.CreateJobRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.CreateJobRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.CreateJobRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for creating a Job.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.CreateJobRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.CreateJobRequest) + com.google.cloud.run.v2.CreateJobRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_CreateJobRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_CreateJobRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.CreateJobRequest.class, + com.google.cloud.run.v2.CreateJobRequest.Builder.class); + } + + // Construct using com.google.cloud.run.v2.CreateJobRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (jobBuilder_ == null) { + job_ = null; + } else { + job_ = null; + jobBuilder_ = null; + } + jobId_ = ""; + + validateOnly_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_CreateJobRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.CreateJobRequest getDefaultInstanceForType() { + return com.google.cloud.run.v2.CreateJobRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.CreateJobRequest build() { + com.google.cloud.run.v2.CreateJobRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.CreateJobRequest buildPartial() { + com.google.cloud.run.v2.CreateJobRequest result = + new com.google.cloud.run.v2.CreateJobRequest(this); + result.parent_ = parent_; + if (jobBuilder_ == null) { + result.job_ = job_; + } else { + result.job_ = jobBuilder_.build(); + } + result.jobId_ = jobId_; + result.validateOnly_ = validateOnly_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.CreateJobRequest) { + return mergeFrom((com.google.cloud.run.v2.CreateJobRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.CreateJobRequest other) { + if (other == com.google.cloud.run.v2.CreateJobRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasJob()) { + mergeJob(other.getJob()); + } + if (!other.getJobId().isEmpty()) { + jobId_ = other.jobId_; + onChanged(); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + input.readMessage(getJobFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 18 + case 26: + { + jobId_ = input.readStringRequireUtf8(); + + break; + } // case 26 + case 32: + { + validateOnly_ = input.readBool(); + + break; + } // case 32 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The location and project in which this Job should be created.
+     * Format: projects/{project}/locations/{location}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The location and project in which this Job should be created.
+     * Format: projects/{project}/locations/{location}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The location and project in which this Job should be created.
+     * Format: projects/{project}/locations/{location}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The location and project in which this Job should be created.
+     * Format: projects/{project}/locations/{location}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The location and project in which this Job should be created.
+     * Format: projects/{project}/locations/{location}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.cloud.run.v2.Job job_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.Job, + com.google.cloud.run.v2.Job.Builder, + com.google.cloud.run.v2.JobOrBuilder> + jobBuilder_; + /** + * + * + *
+     * Required. The Job instance to create.
+     * 
+ * + * .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the job field is set. + */ + public boolean hasJob() { + return jobBuilder_ != null || job_ != null; + } + /** + * + * + *
+     * Required. The Job instance to create.
+     * 
+ * + * .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The job. + */ + public com.google.cloud.run.v2.Job getJob() { + if (jobBuilder_ == null) { + return job_ == null ? com.google.cloud.run.v2.Job.getDefaultInstance() : job_; + } else { + return jobBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The Job instance to create.
+     * 
+ * + * .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setJob(com.google.cloud.run.v2.Job value) { + if (jobBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + job_ = value; + onChanged(); + } else { + jobBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The Job instance to create.
+     * 
+ * + * .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setJob(com.google.cloud.run.v2.Job.Builder builderForValue) { + if (jobBuilder_ == null) { + job_ = builderForValue.build(); + onChanged(); + } else { + jobBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The Job instance to create.
+     * 
+ * + * .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeJob(com.google.cloud.run.v2.Job value) { + if (jobBuilder_ == null) { + if (job_ != null) { + job_ = com.google.cloud.run.v2.Job.newBuilder(job_).mergeFrom(value).buildPartial(); + } else { + job_ = value; + } + onChanged(); + } else { + jobBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The Job instance to create.
+     * 
+ * + * .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearJob() { + if (jobBuilder_ == null) { + job_ = null; + onChanged(); + } else { + job_ = null; + jobBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The Job instance to create.
+     * 
+ * + * .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.run.v2.Job.Builder getJobBuilder() { + + onChanged(); + return getJobFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The Job instance to create.
+     * 
+ * + * .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.run.v2.JobOrBuilder getJobOrBuilder() { + if (jobBuilder_ != null) { + return jobBuilder_.getMessageOrBuilder(); + } else { + return job_ == null ? com.google.cloud.run.v2.Job.getDefaultInstance() : job_; + } + } + /** + * + * + *
+     * Required. The Job instance to create.
+     * 
+ * + * .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.Job, + com.google.cloud.run.v2.Job.Builder, + com.google.cloud.run.v2.JobOrBuilder> + getJobFieldBuilder() { + if (jobBuilder_ == null) { + jobBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.Job, + com.google.cloud.run.v2.Job.Builder, + com.google.cloud.run.v2.JobOrBuilder>(getJob(), getParentForChildren(), isClean()); + job_ = null; + } + return jobBuilder_; + } + + private java.lang.Object jobId_ = ""; + /** + * + * + *
+     * Required. The unique identifier for the Job. The name of the job becomes
+     * {parent}/jobs/{job_id}.
+     * 
+ * + * string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The jobId. + */ + public java.lang.String getJobId() { + java.lang.Object ref = jobId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + jobId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The unique identifier for the Job. The name of the job becomes
+     * {parent}/jobs/{job_id}.
+     * 
+ * + * string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for jobId. + */ + public com.google.protobuf.ByteString getJobIdBytes() { + java.lang.Object ref = jobId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + jobId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The unique identifier for the Job. The name of the job becomes
+     * {parent}/jobs/{job_id}.
+     * 
+ * + * string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The jobId to set. + * @return This builder for chaining. + */ + public Builder setJobId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + jobId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The unique identifier for the Job. The name of the job becomes
+     * {parent}/jobs/{job_id}.
+     * 
+ * + * string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearJobId() { + + jobId_ = getDefaultInstance().getJobId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The unique identifier for the Job. The name of the job becomes
+     * {parent}/jobs/{job_id}.
+     * 
+ * + * string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for jobId to set. + * @return This builder for chaining. + */ + public Builder setJobIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + jobId_ = value; + onChanged(); + return this; + } + + private boolean validateOnly_; + /** + * + * + *
+     * Indicates that the request should be validated and default values
+     * populated, without persisting the request or creating any resources.
+     * 
+ * + * bool validate_only = 4; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * Indicates that the request should be validated and default values
+     * populated, without persisting the request or creating any resources.
+     * 
+ * + * bool validate_only = 4; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Indicates that the request should be validated and default values
+     * populated, without persisting the request or creating any resources.
+     * 
+ * + * bool validate_only = 4; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.CreateJobRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.CreateJobRequest) + private static final com.google.cloud.run.v2.CreateJobRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.CreateJobRequest(); + } + + public static com.google.cloud.run.v2.CreateJobRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateJobRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.CreateJobRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateJobRequestOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateJobRequestOrBuilder.java new file mode 100644 index 000000000000..5632468e5076 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateJobRequestOrBuilder.java @@ -0,0 +1,132 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +public interface CreateJobRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.CreateJobRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The location and project in which this Job should be created.
+   * Format: projects/{project}/locations/{location}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The location and project in which this Job should be created.
+   * Format: projects/{project}/locations/{location}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The Job instance to create.
+   * 
+ * + * .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the job field is set. + */ + boolean hasJob(); + /** + * + * + *
+   * Required. The Job instance to create.
+   * 
+ * + * .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The job. + */ + com.google.cloud.run.v2.Job getJob(); + /** + * + * + *
+   * Required. The Job instance to create.
+   * 
+ * + * .google.cloud.run.v2.Job job = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.cloud.run.v2.JobOrBuilder getJobOrBuilder(); + + /** + * + * + *
+   * Required. The unique identifier for the Job. The name of the job becomes
+   * {parent}/jobs/{job_id}.
+   * 
+ * + * string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The jobId. + */ + java.lang.String getJobId(); + /** + * + * + *
+   * Required. The unique identifier for the Job. The name of the job becomes
+   * {parent}/jobs/{job_id}.
+   * 
+ * + * string job_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for jobId. + */ + com.google.protobuf.ByteString getJobIdBytes(); + + /** + * + * + *
+   * Indicates that the request should be validated and default values
+   * populated, without persisting the request or creating any resources.
+   * 
+ * + * bool validate_only = 4; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateServiceRequest.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateServiceRequest.java index 415dbba2568d..c5fa22173f41 100644 --- a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateServiceRequest.java +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateServiceRequest.java @@ -74,7 +74,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * * *
-   * The location and project in which this service should be created.
+   * Required. The location and project in which this service should be created.
    * Format: projects/{project}/locations/{location}
    * Only lowercase characters, digits, and hyphens.
    * 
@@ -101,7 +101,7 @@ public java.lang.String getParent() { * * *
-   * The location and project in which this service should be created.
+   * Required. The location and project in which this service should be created.
    * Format: projects/{project}/locations/{location}
    * Only lowercase characters, digits, and hyphens.
    * 
@@ -657,7 +657,7 @@ public Builder mergeFrom( * * *
-     * The location and project in which this service should be created.
+     * Required. The location and project in which this service should be created.
      * Format: projects/{project}/locations/{location}
      * Only lowercase characters, digits, and hyphens.
      * 
@@ -683,7 +683,7 @@ public java.lang.String getParent() { * * *
-     * The location and project in which this service should be created.
+     * Required. The location and project in which this service should be created.
      * Format: projects/{project}/locations/{location}
      * Only lowercase characters, digits, and hyphens.
      * 
@@ -709,7 +709,7 @@ public com.google.protobuf.ByteString getParentBytes() { * * *
-     * The location and project in which this service should be created.
+     * Required. The location and project in which this service should be created.
      * Format: projects/{project}/locations/{location}
      * Only lowercase characters, digits, and hyphens.
      * 
@@ -734,7 +734,7 @@ public Builder setParent(java.lang.String value) { * * *
-     * The location and project in which this service should be created.
+     * Required. The location and project in which this service should be created.
      * Format: projects/{project}/locations/{location}
      * Only lowercase characters, digits, and hyphens.
      * 
@@ -755,7 +755,7 @@ public Builder clearParent() { * * *
-     * The location and project in which this service should be created.
+     * Required. The location and project in which this service should be created.
      * Format: projects/{project}/locations/{location}
      * Only lowercase characters, digits, and hyphens.
      * 
diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateServiceRequestOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateServiceRequestOrBuilder.java index 0c244e8585d3..6b8f4a596f42 100644 --- a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateServiceRequestOrBuilder.java +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/CreateServiceRequestOrBuilder.java @@ -27,7 +27,7 @@ public interface CreateServiceRequestOrBuilder * * *
-   * The location and project in which this service should be created.
+   * Required. The location and project in which this service should be created.
    * Format: projects/{project}/locations/{location}
    * Only lowercase characters, digits, and hyphens.
    * 
@@ -43,7 +43,7 @@ public interface CreateServiceRequestOrBuilder * * *
-   * The location and project in which this service should be created.
+   * Required. The location and project in which this service should be created.
    * Format: projects/{project}/locations/{location}
    * Only lowercase characters, digits, and hyphens.
    * 
diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteExecutionRequest.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteExecutionRequest.java new file mode 100644 index 000000000000..330d7c46fbe6 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteExecutionRequest.java @@ -0,0 +1,922 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/execution.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Request message for deleting an Execution.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.DeleteExecutionRequest} + */ +public final class DeleteExecutionRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.DeleteExecutionRequest) + DeleteExecutionRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteExecutionRequest.newBuilder() to construct. + private DeleteExecutionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteExecutionRequest() { + name_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteExecutionRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_DeleteExecutionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_DeleteExecutionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.DeleteExecutionRequest.class, + com.google.cloud.run.v2.DeleteExecutionRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the Execution to delete.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the Execution to delete.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 2; + private boolean validateOnly_; + /** + * + * + *
+   * Indicates that the request should be validated without actually
+   * deleting any resources.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + public static final int ETAG_FIELD_NUMBER = 3; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * A system-generated fingerprint for this version of the resource.
+   * This may be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 3; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * A system-generated fingerprint for this version of the resource.
+   * This may be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 3; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (validateOnly_ != false) { + output.writeBool(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, etag_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, etag_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.DeleteExecutionRequest)) { + return super.equals(obj); + } + com.google.cloud.run.v2.DeleteExecutionRequest other = + (com.google.cloud.run.v2.DeleteExecutionRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.DeleteExecutionRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.DeleteExecutionRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.DeleteExecutionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.DeleteExecutionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.DeleteExecutionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.DeleteExecutionRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.DeleteExecutionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.DeleteExecutionRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.DeleteExecutionRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.DeleteExecutionRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.DeleteExecutionRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.DeleteExecutionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.DeleteExecutionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for deleting an Execution.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.DeleteExecutionRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.DeleteExecutionRequest) + com.google.cloud.run.v2.DeleteExecutionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_DeleteExecutionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_DeleteExecutionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.DeleteExecutionRequest.class, + com.google.cloud.run.v2.DeleteExecutionRequest.Builder.class); + } + + // Construct using com.google.cloud.run.v2.DeleteExecutionRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + validateOnly_ = false; + + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_DeleteExecutionRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.DeleteExecutionRequest getDefaultInstanceForType() { + return com.google.cloud.run.v2.DeleteExecutionRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.DeleteExecutionRequest build() { + com.google.cloud.run.v2.DeleteExecutionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.DeleteExecutionRequest buildPartial() { + com.google.cloud.run.v2.DeleteExecutionRequest result = + new com.google.cloud.run.v2.DeleteExecutionRequest(this); + result.name_ = name_; + result.validateOnly_ = validateOnly_; + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.DeleteExecutionRequest) { + return mergeFrom((com.google.cloud.run.v2.DeleteExecutionRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.DeleteExecutionRequest other) { + if (other == com.google.cloud.run.v2.DeleteExecutionRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 16: + { + validateOnly_ = input.readBool(); + + break; + } // case 16 + case 26: + { + etag_ = input.readStringRequireUtf8(); + + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the Execution to delete.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the Execution to delete.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the Execution to delete.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Execution to delete.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Execution to delete.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private boolean validateOnly_; + /** + * + * + *
+     * Indicates that the request should be validated without actually
+     * deleting any resources.
+     * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * Indicates that the request should be validated without actually
+     * deleting any resources.
+     * 
+ * + * bool validate_only = 2; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Indicates that the request should be validated without actually
+     * deleting any resources.
+     * 
+ * + * bool validate_only = 2; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * A system-generated fingerprint for this version of the resource.
+     * This may be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 3; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A system-generated fingerprint for this version of the resource.
+     * This may be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 3; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A system-generated fingerprint for this version of the resource.
+     * This may be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 3; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A system-generated fingerprint for this version of the resource.
+     * This may be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 3; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * A system-generated fingerprint for this version of the resource.
+     * This may be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 3; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.DeleteExecutionRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.DeleteExecutionRequest) + private static final com.google.cloud.run.v2.DeleteExecutionRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.DeleteExecutionRequest(); + } + + public static com.google.cloud.run.v2.DeleteExecutionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteExecutionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.DeleteExecutionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteExecutionRequestOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteExecutionRequestOrBuilder.java new file mode 100644 index 000000000000..fe261de25f32 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteExecutionRequestOrBuilder.java @@ -0,0 +1,99 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/execution.proto + +package com.google.cloud.run.v2; + +public interface DeleteExecutionRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.DeleteExecutionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the Execution to delete.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the Execution to delete.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Indicates that the request should be validated without actually
+   * deleting any resources.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); + + /** + * + * + *
+   * A system-generated fingerprint for this version of the resource.
+   * This may be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 3; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * A system-generated fingerprint for this version of the resource.
+   * This may be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 3; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteJobRequest.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteJobRequest.java new file mode 100644 index 000000000000..d5b667c41a1c --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteJobRequest.java @@ -0,0 +1,914 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Request message to delete a Job by its full name.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.DeleteJobRequest} + */ +public final class DeleteJobRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.DeleteJobRequest) + DeleteJobRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteJobRequest.newBuilder() to construct. + private DeleteJobRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteJobRequest() { + name_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteJobRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_DeleteJobRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_DeleteJobRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.DeleteJobRequest.class, + com.google.cloud.run.v2.DeleteJobRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The full name of the Job.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The full name of the Job.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 3; + private boolean validateOnly_; + /** + * + * + *
+   * Indicates that the request should be validated without actually
+   * deleting any resources.
+   * 
+ * + * bool validate_only = 3; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + public static final int ETAG_FIELD_NUMBER = 4; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 4; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 4; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (validateOnly_ != false) { + output.writeBool(3, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, etag_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, etag_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.DeleteJobRequest)) { + return super.equals(obj); + } + com.google.cloud.run.v2.DeleteJobRequest other = (com.google.cloud.run.v2.DeleteJobRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.DeleteJobRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.DeleteJobRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.DeleteJobRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.DeleteJobRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.DeleteJobRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.DeleteJobRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.DeleteJobRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.DeleteJobRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.DeleteJobRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.DeleteJobRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.DeleteJobRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.DeleteJobRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.DeleteJobRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message to delete a Job by its full name.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.DeleteJobRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.DeleteJobRequest) + com.google.cloud.run.v2.DeleteJobRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_DeleteJobRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_DeleteJobRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.DeleteJobRequest.class, + com.google.cloud.run.v2.DeleteJobRequest.Builder.class); + } + + // Construct using com.google.cloud.run.v2.DeleteJobRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + validateOnly_ = false; + + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_DeleteJobRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.DeleteJobRequest getDefaultInstanceForType() { + return com.google.cloud.run.v2.DeleteJobRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.DeleteJobRequest build() { + com.google.cloud.run.v2.DeleteJobRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.DeleteJobRequest buildPartial() { + com.google.cloud.run.v2.DeleteJobRequest result = + new com.google.cloud.run.v2.DeleteJobRequest(this); + result.name_ = name_; + result.validateOnly_ = validateOnly_; + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.DeleteJobRequest) { + return mergeFrom((com.google.cloud.run.v2.DeleteJobRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.DeleteJobRequest other) { + if (other == com.google.cloud.run.v2.DeleteJobRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 24: + { + validateOnly_ = input.readBool(); + + break; + } // case 24 + case 34: + { + etag_ = input.readStringRequireUtf8(); + + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The full name of the Job.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The full name of the Job.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The full name of the Job.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The full name of the Job.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The full name of the Job.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private boolean validateOnly_; + /** + * + * + *
+     * Indicates that the request should be validated without actually
+     * deleting any resources.
+     * 
+ * + * bool validate_only = 3; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * Indicates that the request should be validated without actually
+     * deleting any resources.
+     * 
+ * + * bool validate_only = 3; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Indicates that the request should be validated without actually
+     * deleting any resources.
+     * 
+ * + * bool validate_only = 3; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 4; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 4; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 4; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 4; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 4; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.DeleteJobRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.DeleteJobRequest) + private static final com.google.cloud.run.v2.DeleteJobRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.DeleteJobRequest(); + } + + public static com.google.cloud.run.v2.DeleteJobRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteJobRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.DeleteJobRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteJobRequestOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteJobRequestOrBuilder.java new file mode 100644 index 000000000000..138c20f5521a --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/DeleteJobRequestOrBuilder.java @@ -0,0 +1,97 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +public interface DeleteJobRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.DeleteJobRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The full name of the Job.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The full name of the Job.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Indicates that the request should be validated without actually
+   * deleting any resources.
+   * 
+ * + * bool validate_only = 3; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); + + /** + * + * + *
+   * A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 4; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 4; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/Execution.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/Execution.java new file mode 100644 index 000000000000..100f3473e774 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/Execution.java @@ -0,0 +1,5516 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/execution.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Execution represents the configuration of a single execution. A execution an
+ * immutable resource that references a container image which is run to
+ * completion.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.Execution} + */ +public final class Execution extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.Execution) + ExecutionOrBuilder { + private static final long serialVersionUID = 0L; + // Use Execution.newBuilder() to construct. + private Execution(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Execution() { + name_ = ""; + uid_ = ""; + launchStage_ = 0; + job_ = ""; + conditions_ = java.util.Collections.emptyList(); + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Execution(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_Execution_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 4: + return internalGetLabels(); + case 5: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_Execution_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.Execution.class, + com.google.cloud.run.v2.Execution.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Output only. The unique name of this Execution.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The unique name of this Execution.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int UID_FIELD_NUMBER = 2; + private volatile java.lang.Object uid_; + /** + * + * + *
+   * Output only. Server assigned unique identifier for the Execution. The value
+   * is a UUID4 string and guaranteed to remain unchanged until the resource is
+   * deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + @java.lang.Override + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Server assigned unique identifier for the Execution. The value
+   * is a UUID4 string and guaranteed to remain unchanged until the resource is
+   * deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int GENERATION_FIELD_NUMBER = 3; + private long generation_; + /** + * + * + *
+   * Output only. A number that monotonically increases every time the user
+   * modifies the desired state.
+   * 
+ * + * int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The generation. + */ + @java.lang.Override + public long getGeneration() { + return generation_; + } + + public static final int LABELS_FIELD_NUMBER = 4; + + private static final class LabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_Execution_LabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int ANNOTATIONS_FIELD_NUMBER = 5; + + private static final class AnnotationsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_Execution_AnnotationsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int CREATE_TIME_FIELD_NUMBER = 6; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Output only. Represents time when the execution was acknowledged by the
+   * execution controller. It is not guaranteed to be set in happens-before
+   * order across separate operations.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Output only. Represents time when the execution was acknowledged by the
+   * execution controller. It is not guaranteed to be set in happens-before
+   * order across separate operations.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Output only. Represents time when the execution was acknowledged by the
+   * execution controller. It is not guaranteed to be set in happens-before
+   * order across separate operations.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int START_TIME_FIELD_NUMBER = 22; + private com.google.protobuf.Timestamp startTime_; + /** + * + * + *
+   * Output only. Represents time when the execution started to run.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the startTime field is set. + */ + @java.lang.Override + public boolean hasStartTime() { + return startTime_ != null; + } + /** + * + * + *
+   * Output only. Represents time when the execution started to run.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The startTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getStartTime() { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + /** + * + * + *
+   * Output only. Represents time when the execution started to run.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + return getStartTime(); + } + + public static final int COMPLETION_TIME_FIELD_NUMBER = 7; + private com.google.protobuf.Timestamp completionTime_; + /** + * + * + *
+   * Output only. Represents time when the execution was completed. It is not
+   * guaranteed to be set in happens-before order across separate operations.
+   * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the completionTime field is set. + */ + @java.lang.Override + public boolean hasCompletionTime() { + return completionTime_ != null; + } + /** + * + * + *
+   * Output only. Represents time when the execution was completed. It is not
+   * guaranteed to be set in happens-before order across separate operations.
+   * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The completionTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCompletionTime() { + return completionTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : completionTime_; + } + /** + * + * + *
+   * Output only. Represents time when the execution was completed. It is not
+   * guaranteed to be set in happens-before order across separate operations.
+   * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCompletionTimeOrBuilder() { + return getCompletionTime(); + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 8; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + public static final int DELETE_TIME_FIELD_NUMBER = 9; + private com.google.protobuf.Timestamp deleteTime_; + /** + * + * + *
+   * Output only. For a deleted resource, the deletion time. It is only
+   * populated as a response to a Delete request.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + @java.lang.Override + public boolean hasDeleteTime() { + return deleteTime_ != null; + } + /** + * + * + *
+   * Output only. For a deleted resource, the deletion time. It is only
+   * populated as a response to a Delete request.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getDeleteTime() { + return deleteTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : deleteTime_; + } + /** + * + * + *
+   * Output only. For a deleted resource, the deletion time. It is only
+   * populated as a response to a Delete request.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + return getDeleteTime(); + } + + public static final int EXPIRE_TIME_FIELD_NUMBER = 10; + private com.google.protobuf.Timestamp expireTime_; + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted. It is only populated as a response to a Delete
+   * request.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + @java.lang.Override + public boolean hasExpireTime() { + return expireTime_ != null; + } + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted. It is only populated as a response to a Delete
+   * request.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getExpireTime() { + return expireTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : expireTime_; + } + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted. It is only populated as a response to a Delete
+   * request.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + return getExpireTime(); + } + + public static final int LAUNCH_STAGE_FIELD_NUMBER = 11; + private int launchStage_; + /** + * + * + *
+   * Set the launch stage to a preview stage on write to allow use of preview
+   * features in that stage. On read, describes whether the resource uses
+   * preview features. Launch Stages are defined at [Google Cloud Platform
+   * Launch Stages](https://cloud.google.com/terms/launch-stages).
+   * 
+ * + * .google.api.LaunchStage launch_stage = 11; + * + * @return The enum numeric value on the wire for launchStage. + */ + @java.lang.Override + public int getLaunchStageValue() { + return launchStage_; + } + /** + * + * + *
+   * Set the launch stage to a preview stage on write to allow use of preview
+   * features in that stage. On read, describes whether the resource uses
+   * preview features. Launch Stages are defined at [Google Cloud Platform
+   * Launch Stages](https://cloud.google.com/terms/launch-stages).
+   * 
+ * + * .google.api.LaunchStage launch_stage = 11; + * + * @return The launchStage. + */ + @java.lang.Override + public com.google.api.LaunchStage getLaunchStage() { + @SuppressWarnings("deprecation") + com.google.api.LaunchStage result = com.google.api.LaunchStage.valueOf(launchStage_); + return result == null ? com.google.api.LaunchStage.UNRECOGNIZED : result; + } + + public static final int JOB_FIELD_NUMBER = 12; + private volatile java.lang.Object job_; + /** + * + * + *
+   * Output only. The name of the parent Job.
+   * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The job. + */ + @java.lang.Override + public java.lang.String getJob() { + java.lang.Object ref = job_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + job_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The name of the parent Job.
+   * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for job. + */ + @java.lang.Override + public com.google.protobuf.ByteString getJobBytes() { + java.lang.Object ref = job_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + job_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PARALLELISM_FIELD_NUMBER = 13; + private int parallelism_; + /** + * + * + *
+   * Output only. Specifies the maximum desired number of tasks the execution
+   * should run at any given time. Must be <= task_count. The actual number of
+   * tasks running in steady state will be less than this number when
+   * ((.spec.task_count - .status.successful) < .spec.parallelism), i.e. when
+   * the work left to do is less than max parallelism. More info:
+   * https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
+   * 
+ * + * int32 parallelism = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The parallelism. + */ + @java.lang.Override + public int getParallelism() { + return parallelism_; + } + + public static final int TASK_COUNT_FIELD_NUMBER = 14; + private int taskCount_; + /** + * + * + *
+   * Output only. Specifies the desired number of tasks the execution should
+   * run. Setting to 1 means that parallelism is limited to 1 and the success of
+   * that task signals the success of the execution.
+   * More info:
+   * https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
+   * 
+ * + * int32 task_count = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The taskCount. + */ + @java.lang.Override + public int getTaskCount() { + return taskCount_; + } + + public static final int TEMPLATE_FIELD_NUMBER = 15; + private com.google.cloud.run.v2.TaskTemplate template_; + /** + * + * + *
+   * Output only. The template used to create tasks for this execution.
+   * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the template field is set. + */ + @java.lang.Override + public boolean hasTemplate() { + return template_ != null; + } + /** + * + * + *
+   * Output only. The template used to create tasks for this execution.
+   * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The template. + */ + @java.lang.Override + public com.google.cloud.run.v2.TaskTemplate getTemplate() { + return template_ == null + ? com.google.cloud.run.v2.TaskTemplate.getDefaultInstance() + : template_; + } + /** + * + * + *
+   * Output only. The template used to create tasks for this execution.
+   * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.run.v2.TaskTemplateOrBuilder getTemplateOrBuilder() { + return getTemplate(); + } + + public static final int RECONCILING_FIELD_NUMBER = 16; + private boolean reconciling_; + /** + * + * + *
+   * Output only. Indicates whether the resource's reconciliation is still in
+   * progress. See comments in `Job.reconciling` for additional information on
+   * reconciliation process in Cloud Run.
+   * 
+ * + * bool reconciling = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + @java.lang.Override + public boolean getReconciling() { + return reconciling_; + } + + public static final int CONDITIONS_FIELD_NUMBER = 17; + private java.util.List conditions_; + /** + * + * + *
+   * Output only. The Condition of this Execution, containing its readiness
+   * status, and detailed error information in case it did not reach the desired
+   * state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.List getConditionsList() { + return conditions_; + } + /** + * + * + *
+   * Output only. The Condition of this Execution, containing its readiness
+   * status, and detailed error information in case it did not reach the desired
+   * state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.List + getConditionsOrBuilderList() { + return conditions_; + } + /** + * + * + *
+   * Output only. The Condition of this Execution, containing its readiness
+   * status, and detailed error information in case it did not reach the desired
+   * state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public int getConditionsCount() { + return conditions_.size(); + } + /** + * + * + *
+   * Output only. The Condition of this Execution, containing its readiness
+   * status, and detailed error information in case it did not reach the desired
+   * state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.run.v2.Condition getConditions(int index) { + return conditions_.get(index); + } + /** + * + * + *
+   * Output only. The Condition of this Execution, containing its readiness
+   * status, and detailed error information in case it did not reach the desired
+   * state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.run.v2.ConditionOrBuilder getConditionsOrBuilder(int index) { + return conditions_.get(index); + } + + public static final int OBSERVED_GENERATION_FIELD_NUMBER = 18; + private long observedGeneration_; + /** + * + * + *
+   * Output only. The generation of this Execution. See comments in
+   * `reconciling` for additional information on reconciliation process in Cloud
+   * Run.
+   * 
+ * + * int64 observed_generation = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The observedGeneration. + */ + @java.lang.Override + public long getObservedGeneration() { + return observedGeneration_; + } + + public static final int RUNNING_COUNT_FIELD_NUMBER = 19; + private int runningCount_; + /** + * + * + *
+   * Output only. The number of actively running tasks.
+   * 
+ * + * int32 running_count = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The runningCount. + */ + @java.lang.Override + public int getRunningCount() { + return runningCount_; + } + + public static final int SUCCEEDED_COUNT_FIELD_NUMBER = 20; + private int succeededCount_; + /** + * + * + *
+   * Output only. The number of tasks which reached phase Succeeded.
+   * 
+ * + * int32 succeeded_count = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The succeededCount. + */ + @java.lang.Override + public int getSucceededCount() { + return succeededCount_; + } + + public static final int FAILED_COUNT_FIELD_NUMBER = 21; + private int failedCount_; + /** + * + * + *
+   * Output only. The number of tasks which reached phase Failed.
+   * 
+ * + * int32 failed_count = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The failedCount. + */ + @java.lang.Override + public int getFailedCount() { + return failedCount_; + } + + public static final int ETAG_FIELD_NUMBER = 99; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * Output only. A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uid_); + } + if (generation_ != 0L) { + output.writeInt64(3, generation_); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 4); + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetAnnotations(), AnnotationsDefaultEntryHolder.defaultEntry, 5); + if (createTime_ != null) { + output.writeMessage(6, getCreateTime()); + } + if (completionTime_ != null) { + output.writeMessage(7, getCompletionTime()); + } + if (updateTime_ != null) { + output.writeMessage(8, getUpdateTime()); + } + if (deleteTime_ != null) { + output.writeMessage(9, getDeleteTime()); + } + if (expireTime_ != null) { + output.writeMessage(10, getExpireTime()); + } + if (launchStage_ != com.google.api.LaunchStage.LAUNCH_STAGE_UNSPECIFIED.getNumber()) { + output.writeEnum(11, launchStage_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(job_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 12, job_); + } + if (parallelism_ != 0) { + output.writeInt32(13, parallelism_); + } + if (taskCount_ != 0) { + output.writeInt32(14, taskCount_); + } + if (template_ != null) { + output.writeMessage(15, getTemplate()); + } + if (reconciling_ != false) { + output.writeBool(16, reconciling_); + } + for (int i = 0; i < conditions_.size(); i++) { + output.writeMessage(17, conditions_.get(i)); + } + if (observedGeneration_ != 0L) { + output.writeInt64(18, observedGeneration_); + } + if (runningCount_ != 0) { + output.writeInt32(19, runningCount_); + } + if (succeededCount_ != 0) { + output.writeInt32(20, succeededCount_); + } + if (failedCount_ != 0) { + output.writeInt32(21, failedCount_); + } + if (startTime_ != null) { + output.writeMessage(22, getStartTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 99, etag_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uid_); + } + if (generation_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, generation_); + } + for (java.util.Map.Entry entry : + internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry labels__ = + LabelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, labels__); + } + for (java.util.Map.Entry entry : + internalGetAnnotations().getMap().entrySet()) { + com.google.protobuf.MapEntry annotations__ = + AnnotationsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, annotations__); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getCreateTime()); + } + if (completionTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getCompletionTime()); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getUpdateTime()); + } + if (deleteTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getDeleteTime()); + } + if (expireTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(10, getExpireTime()); + } + if (launchStage_ != com.google.api.LaunchStage.LAUNCH_STAGE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(11, launchStage_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(job_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(12, job_); + } + if (parallelism_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(13, parallelism_); + } + if (taskCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(14, taskCount_); + } + if (template_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(15, getTemplate()); + } + if (reconciling_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(16, reconciling_); + } + for (int i = 0; i < conditions_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(17, conditions_.get(i)); + } + if (observedGeneration_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(18, observedGeneration_); + } + if (runningCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(19, runningCount_); + } + if (succeededCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(20, succeededCount_); + } + if (failedCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(21, failedCount_); + } + if (startTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(22, getStartTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(99, etag_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.Execution)) { + return super.equals(obj); + } + com.google.cloud.run.v2.Execution other = (com.google.cloud.run.v2.Execution) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUid().equals(other.getUid())) return false; + if (getGeneration() != other.getGeneration()) return false; + if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (!internalGetAnnotations().equals(other.internalGetAnnotations())) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasStartTime() != other.hasStartTime()) return false; + if (hasStartTime()) { + if (!getStartTime().equals(other.getStartTime())) return false; + } + if (hasCompletionTime() != other.hasCompletionTime()) return false; + if (hasCompletionTime()) { + if (!getCompletionTime().equals(other.getCompletionTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (hasDeleteTime() != other.hasDeleteTime()) return false; + if (hasDeleteTime()) { + if (!getDeleteTime().equals(other.getDeleteTime())) return false; + } + if (hasExpireTime() != other.hasExpireTime()) return false; + if (hasExpireTime()) { + if (!getExpireTime().equals(other.getExpireTime())) return false; + } + if (launchStage_ != other.launchStage_) return false; + if (!getJob().equals(other.getJob())) return false; + if (getParallelism() != other.getParallelism()) return false; + if (getTaskCount() != other.getTaskCount()) return false; + if (hasTemplate() != other.hasTemplate()) return false; + if (hasTemplate()) { + if (!getTemplate().equals(other.getTemplate())) return false; + } + if (getReconciling() != other.getReconciling()) return false; + if (!getConditionsList().equals(other.getConditionsList())) return false; + if (getObservedGeneration() != other.getObservedGeneration()) return false; + if (getRunningCount() != other.getRunningCount()) return false; + if (getSucceededCount() != other.getSucceededCount()) return false; + if (getFailedCount() != other.getFailedCount()) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + UID_FIELD_NUMBER; + hash = (53 * hash) + getUid().hashCode(); + hash = (37 * hash) + GENERATION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getGeneration()); + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + if (!internalGetAnnotations().getMap().isEmpty()) { + hash = (37 * hash) + ANNOTATIONS_FIELD_NUMBER; + hash = (53 * hash) + internalGetAnnotations().hashCode(); + } + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasStartTime()) { + hash = (37 * hash) + START_TIME_FIELD_NUMBER; + hash = (53 * hash) + getStartTime().hashCode(); + } + if (hasCompletionTime()) { + hash = (37 * hash) + COMPLETION_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCompletionTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + if (hasDeleteTime()) { + hash = (37 * hash) + DELETE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getDeleteTime().hashCode(); + } + if (hasExpireTime()) { + hash = (37 * hash) + EXPIRE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getExpireTime().hashCode(); + } + hash = (37 * hash) + LAUNCH_STAGE_FIELD_NUMBER; + hash = (53 * hash) + launchStage_; + hash = (37 * hash) + JOB_FIELD_NUMBER; + hash = (53 * hash) + getJob().hashCode(); + hash = (37 * hash) + PARALLELISM_FIELD_NUMBER; + hash = (53 * hash) + getParallelism(); + hash = (37 * hash) + TASK_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getTaskCount(); + if (hasTemplate()) { + hash = (37 * hash) + TEMPLATE_FIELD_NUMBER; + hash = (53 * hash) + getTemplate().hashCode(); + } + hash = (37 * hash) + RECONCILING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getReconciling()); + if (getConditionsCount() > 0) { + hash = (37 * hash) + CONDITIONS_FIELD_NUMBER; + hash = (53 * hash) + getConditionsList().hashCode(); + } + hash = (37 * hash) + OBSERVED_GENERATION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getObservedGeneration()); + hash = (37 * hash) + RUNNING_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getRunningCount(); + hash = (37 * hash) + SUCCEEDED_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getSucceededCount(); + hash = (37 * hash) + FAILED_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getFailedCount(); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.Execution parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.Execution parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.Execution parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.Execution parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.Execution parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.Execution parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.Execution parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.Execution parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.Execution parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.Execution parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.Execution parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.Execution parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.Execution prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Execution represents the configuration of a single execution. A execution an
+   * immutable resource that references a container image which is run to
+   * completion.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.Execution} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.Execution) + com.google.cloud.run.v2.ExecutionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_Execution_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 4: + return internalGetLabels(); + case 5: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 4: + return internalGetMutableLabels(); + case 5: + return internalGetMutableAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_Execution_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.Execution.class, + com.google.cloud.run.v2.Execution.Builder.class); + } + + // Construct using com.google.cloud.run.v2.Execution.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + uid_ = ""; + + generation_ = 0L; + + internalGetMutableLabels().clear(); + internalGetMutableAnnotations().clear(); + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (startTimeBuilder_ == null) { + startTime_ = null; + } else { + startTime_ = null; + startTimeBuilder_ = null; + } + if (completionTimeBuilder_ == null) { + completionTime_ = null; + } else { + completionTime_ = null; + completionTimeBuilder_ = null; + } + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + if (expireTimeBuilder_ == null) { + expireTime_ = null; + } else { + expireTime_ = null; + expireTimeBuilder_ = null; + } + launchStage_ = 0; + + job_ = ""; + + parallelism_ = 0; + + taskCount_ = 0; + + if (templateBuilder_ == null) { + template_ = null; + } else { + template_ = null; + templateBuilder_ = null; + } + reconciling_ = false; + + if (conditionsBuilder_ == null) { + conditions_ = java.util.Collections.emptyList(); + } else { + conditions_ = null; + conditionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + observedGeneration_ = 0L; + + runningCount_ = 0; + + succeededCount_ = 0; + + failedCount_ = 0; + + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_Execution_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.Execution getDefaultInstanceForType() { + return com.google.cloud.run.v2.Execution.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.Execution build() { + com.google.cloud.run.v2.Execution result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.Execution buildPartial() { + com.google.cloud.run.v2.Execution result = new com.google.cloud.run.v2.Execution(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.uid_ = uid_; + result.generation_ = generation_; + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + result.annotations_ = internalGetAnnotations(); + result.annotations_.makeImmutable(); + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (startTimeBuilder_ == null) { + result.startTime_ = startTime_; + } else { + result.startTime_ = startTimeBuilder_.build(); + } + if (completionTimeBuilder_ == null) { + result.completionTime_ = completionTime_; + } else { + result.completionTime_ = completionTimeBuilder_.build(); + } + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + if (deleteTimeBuilder_ == null) { + result.deleteTime_ = deleteTime_; + } else { + result.deleteTime_ = deleteTimeBuilder_.build(); + } + if (expireTimeBuilder_ == null) { + result.expireTime_ = expireTime_; + } else { + result.expireTime_ = expireTimeBuilder_.build(); + } + result.launchStage_ = launchStage_; + result.job_ = job_; + result.parallelism_ = parallelism_; + result.taskCount_ = taskCount_; + if (templateBuilder_ == null) { + result.template_ = template_; + } else { + result.template_ = templateBuilder_.build(); + } + result.reconciling_ = reconciling_; + if (conditionsBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0)) { + conditions_ = java.util.Collections.unmodifiableList(conditions_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.conditions_ = conditions_; + } else { + result.conditions_ = conditionsBuilder_.build(); + } + result.observedGeneration_ = observedGeneration_; + result.runningCount_ = runningCount_; + result.succeededCount_ = succeededCount_; + result.failedCount_ = failedCount_; + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.Execution) { + return mergeFrom((com.google.cloud.run.v2.Execution) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.Execution other) { + if (other == com.google.cloud.run.v2.Execution.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getUid().isEmpty()) { + uid_ = other.uid_; + onChanged(); + } + if (other.getGeneration() != 0L) { + setGeneration(other.getGeneration()); + } + internalGetMutableLabels().mergeFrom(other.internalGetLabels()); + internalGetMutableAnnotations().mergeFrom(other.internalGetAnnotations()); + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasStartTime()) { + mergeStartTime(other.getStartTime()); + } + if (other.hasCompletionTime()) { + mergeCompletionTime(other.getCompletionTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + if (other.hasDeleteTime()) { + mergeDeleteTime(other.getDeleteTime()); + } + if (other.hasExpireTime()) { + mergeExpireTime(other.getExpireTime()); + } + if (other.launchStage_ != 0) { + setLaunchStageValue(other.getLaunchStageValue()); + } + if (!other.getJob().isEmpty()) { + job_ = other.job_; + onChanged(); + } + if (other.getParallelism() != 0) { + setParallelism(other.getParallelism()); + } + if (other.getTaskCount() != 0) { + setTaskCount(other.getTaskCount()); + } + if (other.hasTemplate()) { + mergeTemplate(other.getTemplate()); + } + if (other.getReconciling() != false) { + setReconciling(other.getReconciling()); + } + if (conditionsBuilder_ == null) { + if (!other.conditions_.isEmpty()) { + if (conditions_.isEmpty()) { + conditions_ = other.conditions_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureConditionsIsMutable(); + conditions_.addAll(other.conditions_); + } + onChanged(); + } + } else { + if (!other.conditions_.isEmpty()) { + if (conditionsBuilder_.isEmpty()) { + conditionsBuilder_.dispose(); + conditionsBuilder_ = null; + conditions_ = other.conditions_; + bitField0_ = (bitField0_ & ~0x00000004); + conditionsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getConditionsFieldBuilder() + : null; + } else { + conditionsBuilder_.addAllMessages(other.conditions_); + } + } + } + if (other.getObservedGeneration() != 0L) { + setObservedGeneration(other.getObservedGeneration()); + } + if (other.getRunningCount() != 0) { + setRunningCount(other.getRunningCount()); + } + if (other.getSucceededCount() != 0) { + setSucceededCount(other.getSucceededCount()); + } + if (other.getFailedCount() != 0) { + setFailedCount(other.getFailedCount()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + uid_ = input.readStringRequireUtf8(); + + break; + } // case 18 + case 24: + { + generation_ = input.readInt64(); + + break; + } // case 24 + case 34: + { + com.google.protobuf.MapEntry labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableLabels() + .getMutableMap() + .put(labels__.getKey(), labels__.getValue()); + break; + } // case 34 + case 42: + { + com.google.protobuf.MapEntry annotations__ = + input.readMessage( + AnnotationsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableAnnotations() + .getMutableMap() + .put(annotations__.getKey(), annotations__.getValue()); + break; + } // case 42 + case 50: + { + input.readMessage(getCreateTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 50 + case 58: + { + input.readMessage(getCompletionTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 58 + case 66: + { + input.readMessage(getUpdateTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 66 + case 74: + { + input.readMessage(getDeleteTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 74 + case 82: + { + input.readMessage(getExpireTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 82 + case 88: + { + launchStage_ = input.readEnum(); + + break; + } // case 88 + case 98: + { + job_ = input.readStringRequireUtf8(); + + break; + } // case 98 + case 104: + { + parallelism_ = input.readInt32(); + + break; + } // case 104 + case 112: + { + taskCount_ = input.readInt32(); + + break; + } // case 112 + case 122: + { + input.readMessage(getTemplateFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 122 + case 128: + { + reconciling_ = input.readBool(); + + break; + } // case 128 + case 138: + { + com.google.cloud.run.v2.Condition m = + input.readMessage( + com.google.cloud.run.v2.Condition.parser(), extensionRegistry); + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + conditions_.add(m); + } else { + conditionsBuilder_.addMessage(m); + } + break; + } // case 138 + case 144: + { + observedGeneration_ = input.readInt64(); + + break; + } // case 144 + case 152: + { + runningCount_ = input.readInt32(); + + break; + } // case 152 + case 160: + { + succeededCount_ = input.readInt32(); + + break; + } // case 160 + case 168: + { + failedCount_ = input.readInt32(); + + break; + } // case 168 + case 178: + { + input.readMessage(getStartTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 178 + case 794: + { + etag_ = input.readStringRequireUtf8(); + + break; + } // case 794 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Output only. The unique name of this Execution.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The unique name of this Execution.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The unique name of this Execution.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The unique name of this Execution.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The unique name of this Execution.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object uid_ = ""; + /** + * + * + *
+     * Output only. Server assigned unique identifier for the Execution. The value
+     * is a UUID4 string and guaranteed to remain unchanged until the resource is
+     * deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the Execution. The value
+     * is a UUID4 string and guaranteed to remain unchanged until the resource is
+     * deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the Execution. The value
+     * is a UUID4 string and guaranteed to remain unchanged until the resource is
+     * deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The uid to set. + * @return This builder for chaining. + */ + public Builder setUid(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uid_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the Execution. The value
+     * is a UUID4 string and guaranteed to remain unchanged until the resource is
+     * deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearUid() { + + uid_ = getDefaultInstance().getUid(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the Execution. The value
+     * is a UUID4 string and guaranteed to remain unchanged until the resource is
+     * deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for uid to set. + * @return This builder for chaining. + */ + public Builder setUidBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uid_ = value; + onChanged(); + return this; + } + + private long generation_; + /** + * + * + *
+     * Output only. A number that monotonically increases every time the user
+     * modifies the desired state.
+     * 
+ * + * int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The generation. + */ + @java.lang.Override + public long getGeneration() { + return generation_; + } + /** + * + * + *
+     * Output only. A number that monotonically increases every time the user
+     * modifies the desired state.
+     * 
+ * + * int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The generation to set. + * @return This builder for chaining. + */ + public Builder setGeneration(long value) { + + generation_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. A number that monotonically increases every time the user
+     * modifies the desired state.
+     * 
+ * + * int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearGeneration() { + + generation_ = 0L; + onChanged(); + return this; + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + private com.google.protobuf.MapField + internalGetMutableLabels() { + onChanged(); + ; + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.lang.String getLabelsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearLabels() { + internalGetMutableLabels().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + public Builder removeLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableLabels().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableLabels() { + return internalGetMutableLabels().getMutableMap(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + public Builder putLabels(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableLabels().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + public Builder putAllLabels(java.util.Map values) { + internalGetMutableLabels().getMutableMap().putAll(values); + return this; + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + private com.google.protobuf.MapField + internalGetMutableAnnotations() { + onChanged(); + ; + if (annotations_ == null) { + annotations_ = + com.google.protobuf.MapField.newMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + if (!annotations_.isMutable()) { + annotations_ = annotations_.copy(); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearAnnotations() { + internalGetMutableAnnotations().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 5; + */ + public Builder removeAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableAnnotations().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableAnnotations() { + return internalGetMutableAnnotations().getMutableMap(); + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 5; + */ + public Builder putAnnotations(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableAnnotations().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 5; + */ + public Builder putAllAnnotations(java.util.Map values) { + internalGetMutableAnnotations().getMutableMap().putAll(values); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Output only. Represents time when the execution was acknowledged by the
+     * execution controller. It is not guaranteed to be set in happens-before
+     * order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * Output only. Represents time when the execution was acknowledged by the
+     * execution controller. It is not guaranteed to be set in happens-before
+     * order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Represents time when the execution was acknowledged by the
+     * execution controller. It is not guaranteed to be set in happens-before
+     * order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the execution was acknowledged by the
+     * execution controller. It is not guaranteed to be set in happens-before
+     * order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the execution was acknowledged by the
+     * execution controller. It is not guaranteed to be set in happens-before
+     * order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the execution was acknowledged by the
+     * execution controller. It is not guaranteed to be set in happens-before
+     * order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the execution was acknowledged by the
+     * execution controller. It is not guaranteed to be set in happens-before
+     * order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Represents time when the execution was acknowledged by the
+     * execution controller. It is not guaranteed to be set in happens-before
+     * order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Output only. Represents time when the execution was acknowledged by the
+     * execution controller. It is not guaranteed to be set in happens-before
+     * order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp startTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + startTimeBuilder_; + /** + * + * + *
+     * Output only. Represents time when the execution started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the startTime field is set. + */ + public boolean hasStartTime() { + return startTimeBuilder_ != null || startTime_ != null; + } + /** + * + * + *
+     * Output only. Represents time when the execution started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The startTime. + */ + public com.google.protobuf.Timestamp getStartTime() { + if (startTimeBuilder_ == null) { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } else { + return startTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Represents time when the execution started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + startTime_ = value; + onChanged(); + } else { + startTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the execution started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setStartTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (startTimeBuilder_ == null) { + startTime_ = builderForValue.build(); + onChanged(); + } else { + startTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the execution started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (startTime_ != null) { + startTime_ = + com.google.protobuf.Timestamp.newBuilder(startTime_).mergeFrom(value).buildPartial(); + } else { + startTime_ = value; + } + onChanged(); + } else { + startTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the execution started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearStartTime() { + if (startTimeBuilder_ == null) { + startTime_ = null; + onChanged(); + } else { + startTime_ = null; + startTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the execution started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getStartTimeBuilder() { + + onChanged(); + return getStartTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Represents time when the execution started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + if (startTimeBuilder_ != null) { + return startTimeBuilder_.getMessageOrBuilder(); + } else { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + } + /** + * + * + *
+     * Output only. Represents time when the execution started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getStartTimeFieldBuilder() { + if (startTimeBuilder_ == null) { + startTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getStartTime(), getParentForChildren(), isClean()); + startTime_ = null; + } + return startTimeBuilder_; + } + + private com.google.protobuf.Timestamp completionTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + completionTimeBuilder_; + /** + * + * + *
+     * Output only. Represents time when the execution was completed. It is not
+     * guaranteed to be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the completionTime field is set. + */ + public boolean hasCompletionTime() { + return completionTimeBuilder_ != null || completionTime_ != null; + } + /** + * + * + *
+     * Output only. Represents time when the execution was completed. It is not
+     * guaranteed to be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The completionTime. + */ + public com.google.protobuf.Timestamp getCompletionTime() { + if (completionTimeBuilder_ == null) { + return completionTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : completionTime_; + } else { + return completionTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Represents time when the execution was completed. It is not
+     * guaranteed to be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCompletionTime(com.google.protobuf.Timestamp value) { + if (completionTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + completionTime_ = value; + onChanged(); + } else { + completionTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the execution was completed. It is not
+     * guaranteed to be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCompletionTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (completionTimeBuilder_ == null) { + completionTime_ = builderForValue.build(); + onChanged(); + } else { + completionTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the execution was completed. It is not
+     * guaranteed to be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCompletionTime(com.google.protobuf.Timestamp value) { + if (completionTimeBuilder_ == null) { + if (completionTime_ != null) { + completionTime_ = + com.google.protobuf.Timestamp.newBuilder(completionTime_) + .mergeFrom(value) + .buildPartial(); + } else { + completionTime_ = value; + } + onChanged(); + } else { + completionTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the execution was completed. It is not
+     * guaranteed to be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCompletionTime() { + if (completionTimeBuilder_ == null) { + completionTime_ = null; + onChanged(); + } else { + completionTime_ = null; + completionTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the execution was completed. It is not
+     * guaranteed to be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCompletionTimeBuilder() { + + onChanged(); + return getCompletionTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Represents time when the execution was completed. It is not
+     * guaranteed to be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCompletionTimeOrBuilder() { + if (completionTimeBuilder_ != null) { + return completionTimeBuilder_.getMessageOrBuilder(); + } else { + return completionTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : completionTime_; + } + } + /** + * + * + *
+     * Output only. Represents time when the execution was completed. It is not
+     * guaranteed to be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCompletionTimeFieldBuilder() { + if (completionTimeBuilder_ == null) { + completionTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCompletionTime(), getParentForChildren(), isClean()); + completionTime_ = null; + } + return completionTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private com.google.protobuf.Timestamp deleteTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + deleteTimeBuilder_; + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + public boolean hasDeleteTime() { + return deleteTimeBuilder_ != null || deleteTime_ != null; + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + public com.google.protobuf.Timestamp getDeleteTime() { + if (deleteTimeBuilder_ == null) { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } else { + return deleteTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + deleteTime_ = value; + onChanged(); + } else { + deleteTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (deleteTimeBuilder_ == null) { + deleteTime_ = builderForValue.build(); + onChanged(); + } else { + deleteTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (deleteTime_ != null) { + deleteTime_ = + com.google.protobuf.Timestamp.newBuilder(deleteTime_).mergeFrom(value).buildPartial(); + } else { + deleteTime_ = value; + } + onChanged(); + } else { + deleteTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearDeleteTime() { + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + onChanged(); + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getDeleteTimeBuilder() { + + onChanged(); + return getDeleteTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + if (deleteTimeBuilder_ != null) { + return deleteTimeBuilder_.getMessageOrBuilder(); + } else { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getDeleteTimeFieldBuilder() { + if (deleteTimeBuilder_ == null) { + deleteTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getDeleteTime(), getParentForChildren(), isClean()); + deleteTime_ = null; + } + return deleteTimeBuilder_; + } + + private com.google.protobuf.Timestamp expireTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + expireTimeBuilder_; + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + public boolean hasExpireTime() { + return expireTimeBuilder_ != null || expireTime_ != null; + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + public com.google.protobuf.Timestamp getExpireTime() { + if (expireTimeBuilder_ == null) { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } else { + return expireTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + expireTime_ = value; + onChanged(); + } else { + expireTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setExpireTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (expireTimeBuilder_ == null) { + expireTime_ = builderForValue.build(); + onChanged(); + } else { + expireTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (expireTime_ != null) { + expireTime_ = + com.google.protobuf.Timestamp.newBuilder(expireTime_).mergeFrom(value).buildPartial(); + } else { + expireTime_ = value; + } + onChanged(); + } else { + expireTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearExpireTime() { + if (expireTimeBuilder_ == null) { + expireTime_ = null; + onChanged(); + } else { + expireTime_ = null; + expireTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getExpireTimeBuilder() { + + onChanged(); + return getExpireTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + if (expireTimeBuilder_ != null) { + return expireTimeBuilder_.getMessageOrBuilder(); + } else { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getExpireTimeFieldBuilder() { + if (expireTimeBuilder_ == null) { + expireTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getExpireTime(), getParentForChildren(), isClean()); + expireTime_ = null; + } + return expireTimeBuilder_; + } + + private int launchStage_ = 0; + /** + * + * + *
+     * Set the launch stage to a preview stage on write to allow use of preview
+     * features in that stage. On read, describes whether the resource uses
+     * preview features. Launch Stages are defined at [Google Cloud Platform
+     * Launch Stages](https://cloud.google.com/terms/launch-stages).
+     * 
+ * + * .google.api.LaunchStage launch_stage = 11; + * + * @return The enum numeric value on the wire for launchStage. + */ + @java.lang.Override + public int getLaunchStageValue() { + return launchStage_; + } + /** + * + * + *
+     * Set the launch stage to a preview stage on write to allow use of preview
+     * features in that stage. On read, describes whether the resource uses
+     * preview features. Launch Stages are defined at [Google Cloud Platform
+     * Launch Stages](https://cloud.google.com/terms/launch-stages).
+     * 
+ * + * .google.api.LaunchStage launch_stage = 11; + * + * @param value The enum numeric value on the wire for launchStage to set. + * @return This builder for chaining. + */ + public Builder setLaunchStageValue(int value) { + + launchStage_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Set the launch stage to a preview stage on write to allow use of preview
+     * features in that stage. On read, describes whether the resource uses
+     * preview features. Launch Stages are defined at [Google Cloud Platform
+     * Launch Stages](https://cloud.google.com/terms/launch-stages).
+     * 
+ * + * .google.api.LaunchStage launch_stage = 11; + * + * @return The launchStage. + */ + @java.lang.Override + public com.google.api.LaunchStage getLaunchStage() { + @SuppressWarnings("deprecation") + com.google.api.LaunchStage result = com.google.api.LaunchStage.valueOf(launchStage_); + return result == null ? com.google.api.LaunchStage.UNRECOGNIZED : result; + } + /** + * + * + *
+     * Set the launch stage to a preview stage on write to allow use of preview
+     * features in that stage. On read, describes whether the resource uses
+     * preview features. Launch Stages are defined at [Google Cloud Platform
+     * Launch Stages](https://cloud.google.com/terms/launch-stages).
+     * 
+ * + * .google.api.LaunchStage launch_stage = 11; + * + * @param value The launchStage to set. + * @return This builder for chaining. + */ + public Builder setLaunchStage(com.google.api.LaunchStage value) { + if (value == null) { + throw new NullPointerException(); + } + + launchStage_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Set the launch stage to a preview stage on write to allow use of preview
+     * features in that stage. On read, describes whether the resource uses
+     * preview features. Launch Stages are defined at [Google Cloud Platform
+     * Launch Stages](https://cloud.google.com/terms/launch-stages).
+     * 
+ * + * .google.api.LaunchStage launch_stage = 11; + * + * @return This builder for chaining. + */ + public Builder clearLaunchStage() { + + launchStage_ = 0; + onChanged(); + return this; + } + + private java.lang.Object job_ = ""; + /** + * + * + *
+     * Output only. The name of the parent Job.
+     * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The job. + */ + public java.lang.String getJob() { + java.lang.Object ref = job_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + job_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The name of the parent Job.
+     * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for job. + */ + public com.google.protobuf.ByteString getJobBytes() { + java.lang.Object ref = job_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + job_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The name of the parent Job.
+     * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The job to set. + * @return This builder for chaining. + */ + public Builder setJob(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + job_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The name of the parent Job.
+     * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearJob() { + + job_ = getDefaultInstance().getJob(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The name of the parent Job.
+     * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for job to set. + * @return This builder for chaining. + */ + public Builder setJobBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + job_ = value; + onChanged(); + return this; + } + + private int parallelism_; + /** + * + * + *
+     * Output only. Specifies the maximum desired number of tasks the execution
+     * should run at any given time. Must be <= task_count. The actual number of
+     * tasks running in steady state will be less than this number when
+     * ((.spec.task_count - .status.successful) < .spec.parallelism), i.e. when
+     * the work left to do is less than max parallelism. More info:
+     * https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
+     * 
+ * + * int32 parallelism = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The parallelism. + */ + @java.lang.Override + public int getParallelism() { + return parallelism_; + } + /** + * + * + *
+     * Output only. Specifies the maximum desired number of tasks the execution
+     * should run at any given time. Must be <= task_count. The actual number of
+     * tasks running in steady state will be less than this number when
+     * ((.spec.task_count - .status.successful) < .spec.parallelism), i.e. when
+     * the work left to do is less than max parallelism. More info:
+     * https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
+     * 
+ * + * int32 parallelism = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The parallelism to set. + * @return This builder for chaining. + */ + public Builder setParallelism(int value) { + + parallelism_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Specifies the maximum desired number of tasks the execution
+     * should run at any given time. Must be <= task_count. The actual number of
+     * tasks running in steady state will be less than this number when
+     * ((.spec.task_count - .status.successful) < .spec.parallelism), i.e. when
+     * the work left to do is less than max parallelism. More info:
+     * https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
+     * 
+ * + * int32 parallelism = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearParallelism() { + + parallelism_ = 0; + onChanged(); + return this; + } + + private int taskCount_; + /** + * + * + *
+     * Output only. Specifies the desired number of tasks the execution should
+     * run. Setting to 1 means that parallelism is limited to 1 and the success of
+     * that task signals the success of the execution.
+     * More info:
+     * https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
+     * 
+ * + * int32 task_count = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The taskCount. + */ + @java.lang.Override + public int getTaskCount() { + return taskCount_; + } + /** + * + * + *
+     * Output only. Specifies the desired number of tasks the execution should
+     * run. Setting to 1 means that parallelism is limited to 1 and the success of
+     * that task signals the success of the execution.
+     * More info:
+     * https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
+     * 
+ * + * int32 task_count = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The taskCount to set. + * @return This builder for chaining. + */ + public Builder setTaskCount(int value) { + + taskCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Specifies the desired number of tasks the execution should
+     * run. Setting to 1 means that parallelism is limited to 1 and the success of
+     * that task signals the success of the execution.
+     * More info:
+     * https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
+     * 
+ * + * int32 task_count = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearTaskCount() { + + taskCount_ = 0; + onChanged(); + return this; + } + + private com.google.cloud.run.v2.TaskTemplate template_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.TaskTemplate, + com.google.cloud.run.v2.TaskTemplate.Builder, + com.google.cloud.run.v2.TaskTemplateOrBuilder> + templateBuilder_; + /** + * + * + *
+     * Output only. The template used to create tasks for this execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the template field is set. + */ + public boolean hasTemplate() { + return templateBuilder_ != null || template_ != null; + } + /** + * + * + *
+     * Output only. The template used to create tasks for this execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The template. + */ + public com.google.cloud.run.v2.TaskTemplate getTemplate() { + if (templateBuilder_ == null) { + return template_ == null + ? com.google.cloud.run.v2.TaskTemplate.getDefaultInstance() + : template_; + } else { + return templateBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The template used to create tasks for this execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setTemplate(com.google.cloud.run.v2.TaskTemplate value) { + if (templateBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + template_ = value; + onChanged(); + } else { + templateBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The template used to create tasks for this execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setTemplate(com.google.cloud.run.v2.TaskTemplate.Builder builderForValue) { + if (templateBuilder_ == null) { + template_ = builderForValue.build(); + onChanged(); + } else { + templateBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The template used to create tasks for this execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeTemplate(com.google.cloud.run.v2.TaskTemplate value) { + if (templateBuilder_ == null) { + if (template_ != null) { + template_ = + com.google.cloud.run.v2.TaskTemplate.newBuilder(template_) + .mergeFrom(value) + .buildPartial(); + } else { + template_ = value; + } + onChanged(); + } else { + templateBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The template used to create tasks for this execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearTemplate() { + if (templateBuilder_ == null) { + template_ = null; + onChanged(); + } else { + template_ = null; + templateBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The template used to create tasks for this execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.TaskTemplate.Builder getTemplateBuilder() { + + onChanged(); + return getTemplateFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The template used to create tasks for this execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.TaskTemplateOrBuilder getTemplateOrBuilder() { + if (templateBuilder_ != null) { + return templateBuilder_.getMessageOrBuilder(); + } else { + return template_ == null + ? com.google.cloud.run.v2.TaskTemplate.getDefaultInstance() + : template_; + } + } + /** + * + * + *
+     * Output only. The template used to create tasks for this execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.TaskTemplate, + com.google.cloud.run.v2.TaskTemplate.Builder, + com.google.cloud.run.v2.TaskTemplateOrBuilder> + getTemplateFieldBuilder() { + if (templateBuilder_ == null) { + templateBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.TaskTemplate, + com.google.cloud.run.v2.TaskTemplate.Builder, + com.google.cloud.run.v2.TaskTemplateOrBuilder>( + getTemplate(), getParentForChildren(), isClean()); + template_ = null; + } + return templateBuilder_; + } + + private boolean reconciling_; + /** + * + * + *
+     * Output only. Indicates whether the resource's reconciliation is still in
+     * progress. See comments in `Job.reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * bool reconciling = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + @java.lang.Override + public boolean getReconciling() { + return reconciling_; + } + /** + * + * + *
+     * Output only. Indicates whether the resource's reconciliation is still in
+     * progress. See comments in `Job.reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * bool reconciling = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The reconciling to set. + * @return This builder for chaining. + */ + public Builder setReconciling(boolean value) { + + reconciling_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Indicates whether the resource's reconciliation is still in
+     * progress. See comments in `Job.reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * bool reconciling = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearReconciling() { + + reconciling_ = false; + onChanged(); + return this; + } + + private java.util.List conditions_ = + java.util.Collections.emptyList(); + + private void ensureConditionsIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + conditions_ = new java.util.ArrayList(conditions_); + bitField0_ |= 0x00000004; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Condition, + com.google.cloud.run.v2.Condition.Builder, + com.google.cloud.run.v2.ConditionOrBuilder> + conditionsBuilder_; + + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List getConditionsList() { + if (conditionsBuilder_ == null) { + return java.util.Collections.unmodifiableList(conditions_); + } else { + return conditionsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public int getConditionsCount() { + if (conditionsBuilder_ == null) { + return conditions_.size(); + } else { + return conditionsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.Condition getConditions(int index) { + if (conditionsBuilder_ == null) { + return conditions_.get(index); + } else { + return conditionsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setConditions(int index, com.google.cloud.run.v2.Condition value) { + if (conditionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureConditionsIsMutable(); + conditions_.set(index, value); + onChanged(); + } else { + conditionsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setConditions( + int index, com.google.cloud.run.v2.Condition.Builder builderForValue) { + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + conditions_.set(index, builderForValue.build()); + onChanged(); + } else { + conditionsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addConditions(com.google.cloud.run.v2.Condition value) { + if (conditionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureConditionsIsMutable(); + conditions_.add(value); + onChanged(); + } else { + conditionsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addConditions(int index, com.google.cloud.run.v2.Condition value) { + if (conditionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureConditionsIsMutable(); + conditions_.add(index, value); + onChanged(); + } else { + conditionsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addConditions(com.google.cloud.run.v2.Condition.Builder builderForValue) { + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + conditions_.add(builderForValue.build()); + onChanged(); + } else { + conditionsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addConditions( + int index, com.google.cloud.run.v2.Condition.Builder builderForValue) { + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + conditions_.add(index, builderForValue.build()); + onChanged(); + } else { + conditionsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addAllConditions( + java.lang.Iterable values) { + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, conditions_); + onChanged(); + } else { + conditionsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearConditions() { + if (conditionsBuilder_ == null) { + conditions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + } else { + conditionsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder removeConditions(int index) { + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + conditions_.remove(index); + onChanged(); + } else { + conditionsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.Condition.Builder getConditionsBuilder(int index) { + return getConditionsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.ConditionOrBuilder getConditionsOrBuilder(int index) { + if (conditionsBuilder_ == null) { + return conditions_.get(index); + } else { + return conditionsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List + getConditionsOrBuilderList() { + if (conditionsBuilder_ != null) { + return conditionsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(conditions_); + } + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.Condition.Builder addConditionsBuilder() { + return getConditionsFieldBuilder() + .addBuilder(com.google.cloud.run.v2.Condition.getDefaultInstance()); + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.Condition.Builder addConditionsBuilder(int index) { + return getConditionsFieldBuilder() + .addBuilder(index, com.google.cloud.run.v2.Condition.getDefaultInstance()); + } + /** + * + * + *
+     * Output only. The Condition of this Execution, containing its readiness
+     * status, and detailed error information in case it did not reach the desired
+     * state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List getConditionsBuilderList() { + return getConditionsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Condition, + com.google.cloud.run.v2.Condition.Builder, + com.google.cloud.run.v2.ConditionOrBuilder> + getConditionsFieldBuilder() { + if (conditionsBuilder_ == null) { + conditionsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Condition, + com.google.cloud.run.v2.Condition.Builder, + com.google.cloud.run.v2.ConditionOrBuilder>( + conditions_, ((bitField0_ & 0x00000004) != 0), getParentForChildren(), isClean()); + conditions_ = null; + } + return conditionsBuilder_; + } + + private long observedGeneration_; + /** + * + * + *
+     * Output only. The generation of this Execution. See comments in
+     * `reconciling` for additional information on reconciliation process in Cloud
+     * Run.
+     * 
+ * + * int64 observed_generation = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The observedGeneration. + */ + @java.lang.Override + public long getObservedGeneration() { + return observedGeneration_; + } + /** + * + * + *
+     * Output only. The generation of this Execution. See comments in
+     * `reconciling` for additional information on reconciliation process in Cloud
+     * Run.
+     * 
+ * + * int64 observed_generation = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The observedGeneration to set. + * @return This builder for chaining. + */ + public Builder setObservedGeneration(long value) { + + observedGeneration_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The generation of this Execution. See comments in
+     * `reconciling` for additional information on reconciliation process in Cloud
+     * Run.
+     * 
+ * + * int64 observed_generation = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearObservedGeneration() { + + observedGeneration_ = 0L; + onChanged(); + return this; + } + + private int runningCount_; + /** + * + * + *
+     * Output only. The number of actively running tasks.
+     * 
+ * + * int32 running_count = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The runningCount. + */ + @java.lang.Override + public int getRunningCount() { + return runningCount_; + } + /** + * + * + *
+     * Output only. The number of actively running tasks.
+     * 
+ * + * int32 running_count = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The runningCount to set. + * @return This builder for chaining. + */ + public Builder setRunningCount(int value) { + + runningCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The number of actively running tasks.
+     * 
+ * + * int32 running_count = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearRunningCount() { + + runningCount_ = 0; + onChanged(); + return this; + } + + private int succeededCount_; + /** + * + * + *
+     * Output only. The number of tasks which reached phase Succeeded.
+     * 
+ * + * int32 succeeded_count = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The succeededCount. + */ + @java.lang.Override + public int getSucceededCount() { + return succeededCount_; + } + /** + * + * + *
+     * Output only. The number of tasks which reached phase Succeeded.
+     * 
+ * + * int32 succeeded_count = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The succeededCount to set. + * @return This builder for chaining. + */ + public Builder setSucceededCount(int value) { + + succeededCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The number of tasks which reached phase Succeeded.
+     * 
+ * + * int32 succeeded_count = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearSucceededCount() { + + succeededCount_ = 0; + onChanged(); + return this; + } + + private int failedCount_; + /** + * + * + *
+     * Output only. The number of tasks which reached phase Failed.
+     * 
+ * + * int32 failed_count = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The failedCount. + */ + @java.lang.Override + public int getFailedCount() { + return failedCount_; + } + /** + * + * + *
+     * Output only. The number of tasks which reached phase Failed.
+     * 
+ * + * int32 failed_count = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The failedCount to set. + * @return This builder for chaining. + */ + public Builder setFailedCount(int value) { + + failedCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The number of tasks which reached phase Failed.
+     * 
+ * + * int32 failed_count = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearFailedCount() { + + failedCount_ = 0; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * Output only. A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.Execution) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.Execution) + private static final com.google.cloud.run.v2.Execution DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.Execution(); + } + + public static com.google.cloud.run.v2.Execution getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Execution parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.Execution getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionName.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionName.java new file mode 100644 index 000000000000..9c3842fe5d60 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionName.java @@ -0,0 +1,257 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class ExecutionName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_JOB_EXECUTION = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/jobs/{job}/executions/{execution}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String job; + private final String execution; + + @Deprecated + protected ExecutionName() { + project = null; + location = null; + job = null; + execution = null; + } + + private ExecutionName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + job = Preconditions.checkNotNull(builder.getJob()); + execution = Preconditions.checkNotNull(builder.getExecution()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getJob() { + return job; + } + + public String getExecution() { + return execution; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static ExecutionName of(String project, String location, String job, String execution) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setJob(job) + .setExecution(execution) + .build(); + } + + public static String format(String project, String location, String job, String execution) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setJob(job) + .setExecution(execution) + .build() + .toString(); + } + + public static ExecutionName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_JOB_EXECUTION.validatedMatch( + formattedString, "ExecutionName.parse: formattedString not in valid format"); + return of( + matchMap.get("project"), + matchMap.get("location"), + matchMap.get("job"), + matchMap.get("execution")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (ExecutionName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_JOB_EXECUTION.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (job != null) { + fieldMapBuilder.put("job", job); + } + if (execution != null) { + fieldMapBuilder.put("execution", execution); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_JOB_EXECUTION.instantiate( + "project", project, "location", location, "job", job, "execution", execution); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ExecutionName that = ((ExecutionName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.job, that.job) + && Objects.equals(this.execution, that.execution); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(job); + h *= 1000003; + h ^= Objects.hashCode(execution); + return h; + } + + /** Builder for projects/{project}/locations/{location}/jobs/{job}/executions/{execution}. */ + public static class Builder { + private String project; + private String location; + private String job; + private String execution; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getJob() { + return job; + } + + public String getExecution() { + return execution; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setJob(String job) { + this.job = job; + return this; + } + + public Builder setExecution(String execution) { + this.execution = execution; + return this; + } + + private Builder(ExecutionName executionName) { + this.project = executionName.project; + this.location = executionName.location; + this.job = executionName.job; + this.execution = executionName.execution; + } + + public ExecutionName build() { + return new ExecutionName(this); + } + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionOrBuilder.java new file mode 100644 index 000000000000..1523d7e9308a --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionOrBuilder.java @@ -0,0 +1,809 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/execution.proto + +package com.google.cloud.run.v2; + +public interface ExecutionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.Execution) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. The unique name of this Execution.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Output only. The unique name of this Execution.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Output only. Server assigned unique identifier for the Execution. The value
+   * is a UUID4 string and guaranteed to remain unchanged until the resource is
+   * deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + java.lang.String getUid(); + /** + * + * + *
+   * Output only. Server assigned unique identifier for the Execution. The value
+   * is a UUID4 string and guaranteed to remain unchanged until the resource is
+   * deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + com.google.protobuf.ByteString getUidBytes(); + + /** + * + * + *
+   * Output only. A number that monotonically increases every time the user
+   * modifies the desired state.
+   * 
+ * + * int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The generation. + */ + long getGeneration(); + + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + int getLabelsCount(); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getLabels(); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + java.util.Map getLabelsMap(); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + + /* nullable */ + java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + java.lang.String getLabelsOrThrow(java.lang.String key); + + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + int getAnnotationsCount(); + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + boolean containsAnnotations(java.lang.String key); + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getAnnotations(); + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + java.util.Map getAnnotationsMap(); + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + + /* nullable */ + java.lang.String getAnnotationsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + java.lang.String getAnnotationsOrThrow(java.lang.String key); + + /** + * + * + *
+   * Output only. Represents time when the execution was acknowledged by the
+   * execution controller. It is not guaranteed to be set in happens-before
+   * order across separate operations.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Output only. Represents time when the execution was acknowledged by the
+   * execution controller. It is not guaranteed to be set in happens-before
+   * order across separate operations.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Output only. Represents time when the execution was acknowledged by the
+   * execution controller. It is not guaranteed to be set in happens-before
+   * order across separate operations.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. Represents time when the execution started to run.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the startTime field is set. + */ + boolean hasStartTime(); + /** + * + * + *
+   * Output only. Represents time when the execution started to run.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The startTime. + */ + com.google.protobuf.Timestamp getStartTime(); + /** + * + * + *
+   * Output only. Represents time when the execution started to run.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder(); + + /** + * + * + *
+   * Output only. Represents time when the execution was completed. It is not
+   * guaranteed to be set in happens-before order across separate operations.
+   * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the completionTime field is set. + */ + boolean hasCompletionTime(); + /** + * + * + *
+   * Output only. Represents time when the execution was completed. It is not
+   * guaranteed to be set in happens-before order across separate operations.
+   * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The completionTime. + */ + com.google.protobuf.Timestamp getCompletionTime(); + /** + * + * + *
+   * Output only. Represents time when the execution was completed. It is not
+   * guaranteed to be set in happens-before order across separate operations.
+   * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCompletionTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. For a deleted resource, the deletion time. It is only
+   * populated as a response to a Delete request.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + boolean hasDeleteTime(); + /** + * + * + *
+   * Output only. For a deleted resource, the deletion time. It is only
+   * populated as a response to a Delete request.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + com.google.protobuf.Timestamp getDeleteTime(); + /** + * + * + *
+   * Output only. For a deleted resource, the deletion time. It is only
+   * populated as a response to a Delete request.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder(); + + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted. It is only populated as a response to a Delete
+   * request.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + boolean hasExpireTime(); + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted. It is only populated as a response to a Delete
+   * request.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + com.google.protobuf.Timestamp getExpireTime(); + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted. It is only populated as a response to a Delete
+   * request.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder(); + + /** + * + * + *
+   * Set the launch stage to a preview stage on write to allow use of preview
+   * features in that stage. On read, describes whether the resource uses
+   * preview features. Launch Stages are defined at [Google Cloud Platform
+   * Launch Stages](https://cloud.google.com/terms/launch-stages).
+   * 
+ * + * .google.api.LaunchStage launch_stage = 11; + * + * @return The enum numeric value on the wire for launchStage. + */ + int getLaunchStageValue(); + /** + * + * + *
+   * Set the launch stage to a preview stage on write to allow use of preview
+   * features in that stage. On read, describes whether the resource uses
+   * preview features. Launch Stages are defined at [Google Cloud Platform
+   * Launch Stages](https://cloud.google.com/terms/launch-stages).
+   * 
+ * + * .google.api.LaunchStage launch_stage = 11; + * + * @return The launchStage. + */ + com.google.api.LaunchStage getLaunchStage(); + + /** + * + * + *
+   * Output only. The name of the parent Job.
+   * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The job. + */ + java.lang.String getJob(); + /** + * + * + *
+   * Output only. The name of the parent Job.
+   * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for job. + */ + com.google.protobuf.ByteString getJobBytes(); + + /** + * + * + *
+   * Output only. Specifies the maximum desired number of tasks the execution
+   * should run at any given time. Must be <= task_count. The actual number of
+   * tasks running in steady state will be less than this number when
+   * ((.spec.task_count - .status.successful) < .spec.parallelism), i.e. when
+   * the work left to do is less than max parallelism. More info:
+   * https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
+   * 
+ * + * int32 parallelism = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The parallelism. + */ + int getParallelism(); + + /** + * + * + *
+   * Output only. Specifies the desired number of tasks the execution should
+   * run. Setting to 1 means that parallelism is limited to 1 and the success of
+   * that task signals the success of the execution.
+   * More info:
+   * https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
+   * 
+ * + * int32 task_count = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The taskCount. + */ + int getTaskCount(); + + /** + * + * + *
+   * Output only. The template used to create tasks for this execution.
+   * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the template field is set. + */ + boolean hasTemplate(); + /** + * + * + *
+   * Output only. The template used to create tasks for this execution.
+   * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The template. + */ + com.google.cloud.run.v2.TaskTemplate getTemplate(); + /** + * + * + *
+   * Output only. The template used to create tasks for this execution.
+   * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 15 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.run.v2.TaskTemplateOrBuilder getTemplateOrBuilder(); + + /** + * + * + *
+   * Output only. Indicates whether the resource's reconciliation is still in
+   * progress. See comments in `Job.reconciling` for additional information on
+   * reconciliation process in Cloud Run.
+   * 
+ * + * bool reconciling = 16 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + boolean getReconciling(); + + /** + * + * + *
+   * Output only. The Condition of this Execution, containing its readiness
+   * status, and detailed error information in case it did not reach the desired
+   * state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.List getConditionsList(); + /** + * + * + *
+   * Output only. The Condition of this Execution, containing its readiness
+   * status, and detailed error information in case it did not reach the desired
+   * state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.run.v2.Condition getConditions(int index); + /** + * + * + *
+   * Output only. The Condition of this Execution, containing its readiness
+   * status, and detailed error information in case it did not reach the desired
+   * state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + int getConditionsCount(); + /** + * + * + *
+   * Output only. The Condition of this Execution, containing its readiness
+   * status, and detailed error information in case it did not reach the desired
+   * state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.List getConditionsOrBuilderList(); + /** + * + * + *
+   * Output only. The Condition of this Execution, containing its readiness
+   * status, and detailed error information in case it did not reach the desired
+   * state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.run.v2.ConditionOrBuilder getConditionsOrBuilder(int index); + + /** + * + * + *
+   * Output only. The generation of this Execution. See comments in
+   * `reconciling` for additional information on reconciliation process in Cloud
+   * Run.
+   * 
+ * + * int64 observed_generation = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The observedGeneration. + */ + long getObservedGeneration(); + + /** + * + * + *
+   * Output only. The number of actively running tasks.
+   * 
+ * + * int32 running_count = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The runningCount. + */ + int getRunningCount(); + + /** + * + * + *
+   * Output only. The number of tasks which reached phase Succeeded.
+   * 
+ * + * int32 succeeded_count = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The succeededCount. + */ + int getSucceededCount(); + + /** + * + * + *
+   * Output only. The number of tasks which reached phase Failed.
+   * 
+ * + * int32 failed_count = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The failedCount. + */ + int getFailedCount(); + + /** + * + * + *
+   * Output only. A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * Output only. A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionProto.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionProto.java new file mode 100644 index 000000000000..226471bccadd --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionProto.java @@ -0,0 +1,252 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/execution.proto + +package com.google.cloud.run.v2; + +public final class ExecutionProto { + private ExecutionProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_GetExecutionRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_GetExecutionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_ListExecutionsRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_ListExecutionsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_ListExecutionsResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_ListExecutionsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_DeleteExecutionRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_DeleteExecutionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_Execution_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_Execution_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_Execution_LabelsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_Execution_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_Execution_AnnotationsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_Execution_AnnotationsEntry_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n#google/cloud/run/v2/execution.proto\022\023g" + + "oogle.cloud.run.v2\032\034google/api/annotatio" + + "ns.proto\032\027google/api/client.proto\032\037googl" + + "e/api/field_behavior.proto\032\035google/api/l" + + "aunch_stage.proto\032\031google/api/resource.p" + + "roto\032#google/cloud/run/v2/condition.prot" + + "o\032\'google/cloud/run/v2/task_template.pro" + + "to\032#google/longrunning/operations.proto\032" + + "\037google/protobuf/timestamp.proto\"I\n\023GetE" + + "xecutionRequest\0222\n\004name\030\001 \001(\tB$\340A\002\372A\036\n\034r" + + "un.googleapis.com/Execution\"\212\001\n\025ListExec" + + "utionsRequest\0224\n\006parent\030\001 \001(\tB$\340A\002\372A\036\022\034r" + + "un.googleapis.com/Execution\022\021\n\tpage_size" + + "\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t\022\024\n\014show_delet" + + "ed\030\004 \001(\010\"e\n\026ListExecutionsResponse\0222\n\nex" + + "ecutions\030\001 \003(\0132\036.google.cloud.run.v2.Exe" + + "cution\022\027\n\017next_page_token\030\002 \001(\t\"q\n\026Delet" + + "eExecutionRequest\0222\n\004name\030\001 \001(\tB$\340A\002\372A\036\n" + + "\034run.googleapis.com/Execution\022\025\n\rvalidat" + + "e_only\030\002 \001(\010\022\014\n\004etag\030\003 \001(\t\"\214\t\n\tExecution" + + "\022\021\n\004name\030\001 \001(\tB\003\340A\003\022\020\n\003uid\030\002 \001(\tB\003\340A\003\022\027\n" + + "\ngeneration\030\003 \001(\003B\003\340A\003\022:\n\006labels\030\004 \003(\0132*" + + ".google.cloud.run.v2.Execution.LabelsEnt" + + "ry\022D\n\013annotations\030\005 \003(\0132/.google.cloud.r" + + "un.v2.Execution.AnnotationsEntry\0224\n\013crea" + + "te_time\030\006 \001(\0132\032.google.protobuf.Timestam" + + "pB\003\340A\003\0223\n\nstart_time\030\026 \001(\0132\032.google.prot" + + "obuf.TimestampB\003\340A\003\0228\n\017completion_time\030\007" + + " \001(\0132\032.google.protobuf.TimestampB\003\340A\003\0224\n" + + "\013update_time\030\010 \001(\0132\032.google.protobuf.Tim" + + "estampB\003\340A\003\0224\n\013delete_time\030\t \001(\0132\032.googl" + + "e.protobuf.TimestampB\003\340A\003\0224\n\013expire_time" + + "\030\n \001(\0132\032.google.protobuf.TimestampB\003\340A\003\022" + + "-\n\014launch_stage\030\013 \001(\0162\027.google.api.Launc" + + "hStage\022+\n\003job\030\014 \001(\tB\036\340A\003\372A\030\n\026run.googlea" + + "pis.com/Job\022\030\n\013parallelism\030\r \001(\005B\003\340A\003\022\027\n" + + "\ntask_count\030\016 \001(\005B\003\340A\003\0228\n\010template\030\017 \001(\013" + + "2!.google.cloud.run.v2.TaskTemplateB\003\340A\003" + + "\022\030\n\013reconciling\030\020 \001(\010B\003\340A\003\0227\n\nconditions" + + "\030\021 \003(\0132\036.google.cloud.run.v2.ConditionB\003" + + "\340A\003\022 \n\023observed_generation\030\022 \001(\003B\003\340A\003\022\032\n" + + "\rrunning_count\030\023 \001(\005B\003\340A\003\022\034\n\017succeeded_c" + + "ount\030\024 \001(\005B\003\340A\003\022\031\n\014failed_count\030\025 \001(\005B\003\340" + + "A\003\022\021\n\004etag\030c \001(\tB\003\340A\003\032-\n\013LabelsEntry\022\013\n\003" + + "key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\0322\n\020Annotati" + + "onsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001" + + ":o\352Al\n\034run.googleapis.com/Execution\022Ipro" + + "jects/{project}/locations/{location}/job" + + "s/{job}/executions/{execution}R\001\0012\350\004\n\nEx" + + "ecutions\022\236\001\n\014GetExecution\022(.google.cloud" + + ".run.v2.GetExecutionRequest\032\036.google.clo" + + "ud.run.v2.Execution\"D\202\323\344\223\0027\0225/v2/{name=p" + + "rojects/*/locations/*/jobs/*/executions/" + + "*}\332A\004name\022\261\001\n\016ListExecutions\022*.google.cl" + + "oud.run.v2.ListExecutionsRequest\032+.googl" + + "e.cloud.run.v2.ListExecutionsResponse\"F\202" + + "\323\344\223\0027\0225/v2/{parent=projects/*/locations/" + + "*/jobs/*}/executions\332A\006parent\022\274\001\n\017Delete" + + "Execution\022+.google.cloud.run.v2.DeleteEx" + + "ecutionRequest\032\035.google.longrunning.Oper" + + "ation\"]\202\323\344\223\0027*5/v2/{name=projects/*/loca" + + "tions/*/jobs/*/executions/*}\332A\004name\312A\026\n\t" + + "Execution\022\tExecution\032F\312A\022run.googleapis." + + "com\322A.https://www.googleapis.com/auth/cl" + + "oud-platformBc\n\027com.google.cloud.run.v2B" + + "\016ExecutionProtoP\001Z6google.golang.org/gen" + + "proto/googleapis/cloud/run/v2;runb\006proto" + + "3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.LaunchStageProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.cloud.run.v2.ConditionProto.getDescriptor(), + com.google.cloud.run.v2.TaskTemplateProto.getDescriptor(), + com.google.longrunning.OperationsProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + }); + internal_static_google_cloud_run_v2_GetExecutionRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_run_v2_GetExecutionRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_GetExecutionRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_run_v2_ListExecutionsRequest_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_run_v2_ListExecutionsRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_ListExecutionsRequest_descriptor, + new java.lang.String[] { + "Parent", "PageSize", "PageToken", "ShowDeleted", + }); + internal_static_google_cloud_run_v2_ListExecutionsResponse_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_run_v2_ListExecutionsResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_ListExecutionsResponse_descriptor, + new java.lang.String[] { + "Executions", "NextPageToken", + }); + internal_static_google_cloud_run_v2_DeleteExecutionRequest_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_run_v2_DeleteExecutionRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_DeleteExecutionRequest_descriptor, + new java.lang.String[] { + "Name", "ValidateOnly", "Etag", + }); + internal_static_google_cloud_run_v2_Execution_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_run_v2_Execution_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_Execution_descriptor, + new java.lang.String[] { + "Name", + "Uid", + "Generation", + "Labels", + "Annotations", + "CreateTime", + "StartTime", + "CompletionTime", + "UpdateTime", + "DeleteTime", + "ExpireTime", + "LaunchStage", + "Job", + "Parallelism", + "TaskCount", + "Template", + "Reconciling", + "Conditions", + "ObservedGeneration", + "RunningCount", + "SucceededCount", + "FailedCount", + "Etag", + }); + internal_static_google_cloud_run_v2_Execution_LabelsEntry_descriptor = + internal_static_google_cloud_run_v2_Execution_descriptor.getNestedTypes().get(0); + internal_static_google_cloud_run_v2_Execution_LabelsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_Execution_LabelsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_cloud_run_v2_Execution_AnnotationsEntry_descriptor = + internal_static_google_cloud_run_v2_Execution_descriptor.getNestedTypes().get(1); + internal_static_google_cloud_run_v2_Execution_AnnotationsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_Execution_AnnotationsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.methodSignature); + registry.add(com.google.api.ClientProto.oauthScopes); + registry.add(com.google.api.ResourceProto.resource); + registry.add(com.google.api.ResourceProto.resourceReference); + registry.add(com.google.longrunning.OperationsProto.operationInfo); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.LaunchStageProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.cloud.run.v2.ConditionProto.getDescriptor(); + com.google.cloud.run.v2.TaskTemplateProto.getDescriptor(); + com.google.longrunning.OperationsProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionReference.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionReference.java new file mode 100644 index 000000000000..8f4c0013e528 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionReference.java @@ -0,0 +1,1146 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Reference to an Execution. Use /Executions.GetExecution with the given name
+ * to get full execution including the latest status.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.ExecutionReference} + */ +public final class ExecutionReference extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.ExecutionReference) + ExecutionReferenceOrBuilder { + private static final long serialVersionUID = 0L; + // Use ExecutionReference.newBuilder() to construct. + private ExecutionReference(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ExecutionReference() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ExecutionReference(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_ExecutionReference_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_ExecutionReference_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ExecutionReference.class, + com.google.cloud.run.v2.ExecutionReference.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Name of the execution.
+   * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Name of the execution.
+   * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CREATE_TIME_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Creation timestamp of the execution.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Creation timestamp of the execution.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Creation timestamp of the execution.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int COMPLETION_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp completionTime_; + /** + * + * + *
+   * Creation timestamp of the execution.
+   * 
+ * + * .google.protobuf.Timestamp completion_time = 3; + * + * @return Whether the completionTime field is set. + */ + @java.lang.Override + public boolean hasCompletionTime() { + return completionTime_ != null; + } + /** + * + * + *
+   * Creation timestamp of the execution.
+   * 
+ * + * .google.protobuf.Timestamp completion_time = 3; + * + * @return The completionTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCompletionTime() { + return completionTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : completionTime_; + } + /** + * + * + *
+   * Creation timestamp of the execution.
+   * 
+ * + * .google.protobuf.Timestamp completion_time = 3; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCompletionTimeOrBuilder() { + return getCompletionTime(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (createTime_ != null) { + output.writeMessage(2, getCreateTime()); + } + if (completionTime_ != null) { + output.writeMessage(3, getCompletionTime()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getCreateTime()); + } + if (completionTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getCompletionTime()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.ExecutionReference)) { + return super.equals(obj); + } + com.google.cloud.run.v2.ExecutionReference other = + (com.google.cloud.run.v2.ExecutionReference) obj; + + if (!getName().equals(other.getName())) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasCompletionTime() != other.hasCompletionTime()) return false; + if (hasCompletionTime()) { + if (!getCompletionTime().equals(other.getCompletionTime())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasCompletionTime()) { + hash = (37 * hash) + COMPLETION_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCompletionTime().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.ExecutionReference parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ExecutionReference parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ExecutionReference parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ExecutionReference parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ExecutionReference parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ExecutionReference parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ExecutionReference parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ExecutionReference parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ExecutionReference parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ExecutionReference parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ExecutionReference parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ExecutionReference parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.ExecutionReference prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Reference to an Execution. Use /Executions.GetExecution with the given name
+   * to get full execution including the latest status.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.ExecutionReference} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.ExecutionReference) + com.google.cloud.run.v2.ExecutionReferenceOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_ExecutionReference_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_ExecutionReference_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ExecutionReference.class, + com.google.cloud.run.v2.ExecutionReference.Builder.class); + } + + // Construct using com.google.cloud.run.v2.ExecutionReference.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (completionTimeBuilder_ == null) { + completionTime_ = null; + } else { + completionTime_ = null; + completionTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_ExecutionReference_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.ExecutionReference getDefaultInstanceForType() { + return com.google.cloud.run.v2.ExecutionReference.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.ExecutionReference build() { + com.google.cloud.run.v2.ExecutionReference result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.ExecutionReference buildPartial() { + com.google.cloud.run.v2.ExecutionReference result = + new com.google.cloud.run.v2.ExecutionReference(this); + result.name_ = name_; + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (completionTimeBuilder_ == null) { + result.completionTime_ = completionTime_; + } else { + result.completionTime_ = completionTimeBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.ExecutionReference) { + return mergeFrom((com.google.cloud.run.v2.ExecutionReference) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.ExecutionReference other) { + if (other == com.google.cloud.run.v2.ExecutionReference.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasCompletionTime()) { + mergeCompletionTime(other.getCompletionTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + input.readMessage(getCreateTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 18 + case 26: + { + input.readMessage(getCompletionTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Name of the execution.
+     * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Name of the execution.
+     * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Name of the execution.
+     * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Name of the execution.
+     * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Name of the execution.
+     * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp completionTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + completionTimeBuilder_; + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp completion_time = 3; + * + * @return Whether the completionTime field is set. + */ + public boolean hasCompletionTime() { + return completionTimeBuilder_ != null || completionTime_ != null; + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp completion_time = 3; + * + * @return The completionTime. + */ + public com.google.protobuf.Timestamp getCompletionTime() { + if (completionTimeBuilder_ == null) { + return completionTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : completionTime_; + } else { + return completionTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp completion_time = 3; + */ + public Builder setCompletionTime(com.google.protobuf.Timestamp value) { + if (completionTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + completionTime_ = value; + onChanged(); + } else { + completionTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp completion_time = 3; + */ + public Builder setCompletionTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (completionTimeBuilder_ == null) { + completionTime_ = builderForValue.build(); + onChanged(); + } else { + completionTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp completion_time = 3; + */ + public Builder mergeCompletionTime(com.google.protobuf.Timestamp value) { + if (completionTimeBuilder_ == null) { + if (completionTime_ != null) { + completionTime_ = + com.google.protobuf.Timestamp.newBuilder(completionTime_) + .mergeFrom(value) + .buildPartial(); + } else { + completionTime_ = value; + } + onChanged(); + } else { + completionTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp completion_time = 3; + */ + public Builder clearCompletionTime() { + if (completionTimeBuilder_ == null) { + completionTime_ = null; + onChanged(); + } else { + completionTime_ = null; + completionTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp completion_time = 3; + */ + public com.google.protobuf.Timestamp.Builder getCompletionTimeBuilder() { + + onChanged(); + return getCompletionTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp completion_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getCompletionTimeOrBuilder() { + if (completionTimeBuilder_ != null) { + return completionTimeBuilder_.getMessageOrBuilder(); + } else { + return completionTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : completionTime_; + } + } + /** + * + * + *
+     * Creation timestamp of the execution.
+     * 
+ * + * .google.protobuf.Timestamp completion_time = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCompletionTimeFieldBuilder() { + if (completionTimeBuilder_ == null) { + completionTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCompletionTime(), getParentForChildren(), isClean()); + completionTime_ = null; + } + return completionTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.ExecutionReference) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.ExecutionReference) + private static final com.google.cloud.run.v2.ExecutionReference DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.ExecutionReference(); + } + + public static com.google.cloud.run.v2.ExecutionReference getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ExecutionReference parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.ExecutionReference getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionReferenceOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionReferenceOrBuilder.java new file mode 100644 index 000000000000..76444219807e --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionReferenceOrBuilder.java @@ -0,0 +1,120 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +public interface ExecutionReferenceOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.ExecutionReference) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Name of the execution.
+   * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Name of the execution.
+   * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Creation timestamp of the execution.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Creation timestamp of the execution.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Creation timestamp of the execution.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 2; + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Creation timestamp of the execution.
+   * 
+ * + * .google.protobuf.Timestamp completion_time = 3; + * + * @return Whether the completionTime field is set. + */ + boolean hasCompletionTime(); + /** + * + * + *
+   * Creation timestamp of the execution.
+   * 
+ * + * .google.protobuf.Timestamp completion_time = 3; + * + * @return The completionTime. + */ + com.google.protobuf.Timestamp getCompletionTime(); + /** + * + * + *
+   * Creation timestamp of the execution.
+   * 
+ * + * .google.protobuf.Timestamp completion_time = 3; + */ + com.google.protobuf.TimestampOrBuilder getCompletionTimeOrBuilder(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionTemplate.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionTemplate.java new file mode 100644 index 000000000000..fa810b68a8a4 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionTemplate.java @@ -0,0 +1,1568 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/execution_template.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * ExecutionTemplate describes the data an execution should have when created
+ * from a template.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.ExecutionTemplate} + */ +public final class ExecutionTemplate extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.ExecutionTemplate) + ExecutionTemplateOrBuilder { + private static final long serialVersionUID = 0L; + // Use ExecutionTemplate.newBuilder() to construct. + private ExecutionTemplate(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ExecutionTemplate() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ExecutionTemplate(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.ExecutionTemplateProto + .internal_static_google_cloud_run_v2_ExecutionTemplate_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 1: + return internalGetLabels(); + case 2: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.ExecutionTemplateProto + .internal_static_google_cloud_run_v2_ExecutionTemplate_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ExecutionTemplate.class, + com.google.cloud.run.v2.ExecutionTemplate.Builder.class); + } + + public static final int LABELS_FIELD_NUMBER = 1; + + private static final class LabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.run.v2.ExecutionTemplateProto + .internal_static_google_cloud_run_v2_ExecutionTemplate_LabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * 
+ * + * map<string, string> labels = 1; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * 
+ * + * map<string, string> labels = 1; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * 
+ * + * map<string, string> labels = 1; + */ + @java.lang.Override + public java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * 
+ * + * map<string, string> labels = 1; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int ANNOTATIONS_FIELD_NUMBER = 2; + + private static final class AnnotationsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.run.v2.ExecutionTemplateProto + .internal_static_google_cloud_run_v2_ExecutionTemplate_AnnotationsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 2; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 2; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 2; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 2; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int PARALLELISM_FIELD_NUMBER = 3; + private int parallelism_; + /** + * + * + *
+   * Specifies the maximum desired number of tasks the execution should run at
+   * given time. Must be <= task_count.
+   * When the job is run, if this field is 0 or unset, the maximum possible
+   * value will be used for that execution.
+   * The actual number of tasks running in steady state will be less than this
+   * number when there are fewer tasks waiting to be completed remaining,
+   * i.e. when the work left to do is less than max parallelism.
+   * 
+ * + * int32 parallelism = 3; + * + * @return The parallelism. + */ + @java.lang.Override + public int getParallelism() { + return parallelism_; + } + + public static final int TASK_COUNT_FIELD_NUMBER = 4; + private int taskCount_; + /** + * + * + *
+   * Specifies the desired number of tasks the execution should run.
+   * Setting to 1 means that parallelism is limited to 1 and the success of
+   * that task signals the success of the execution.
+   * More info:
+   * https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
+   * 
+ * + * int32 task_count = 4; + * + * @return The taskCount. + */ + @java.lang.Override + public int getTaskCount() { + return taskCount_; + } + + public static final int TEMPLATE_FIELD_NUMBER = 5; + private com.google.cloud.run.v2.TaskTemplate template_; + /** + * + * + *
+   * Required. Describes the task(s) that will be created when executing an execution.
+   * 
+ * + * .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the template field is set. + */ + @java.lang.Override + public boolean hasTemplate() { + return template_ != null; + } + /** + * + * + *
+   * Required. Describes the task(s) that will be created when executing an execution.
+   * 
+ * + * .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The template. + */ + @java.lang.Override + public com.google.cloud.run.v2.TaskTemplate getTemplate() { + return template_ == null + ? com.google.cloud.run.v2.TaskTemplate.getDefaultInstance() + : template_; + } + /** + * + * + *
+   * Required. Describes the task(s) that will be created when executing an execution.
+   * 
+ * + * .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.run.v2.TaskTemplateOrBuilder getTemplateOrBuilder() { + return getTemplate(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 1); + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetAnnotations(), AnnotationsDefaultEntryHolder.defaultEntry, 2); + if (parallelism_ != 0) { + output.writeInt32(3, parallelism_); + } + if (taskCount_ != 0) { + output.writeInt32(4, taskCount_); + } + if (template_ != null) { + output.writeMessage(5, getTemplate()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (java.util.Map.Entry entry : + internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry labels__ = + LabelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, labels__); + } + for (java.util.Map.Entry entry : + internalGetAnnotations().getMap().entrySet()) { + com.google.protobuf.MapEntry annotations__ = + AnnotationsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, annotations__); + } + if (parallelism_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, parallelism_); + } + if (taskCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(4, taskCount_); + } + if (template_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getTemplate()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.ExecutionTemplate)) { + return super.equals(obj); + } + com.google.cloud.run.v2.ExecutionTemplate other = + (com.google.cloud.run.v2.ExecutionTemplate) obj; + + if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (!internalGetAnnotations().equals(other.internalGetAnnotations())) return false; + if (getParallelism() != other.getParallelism()) return false; + if (getTaskCount() != other.getTaskCount()) return false; + if (hasTemplate() != other.hasTemplate()) return false; + if (hasTemplate()) { + if (!getTemplate().equals(other.getTemplate())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + if (!internalGetAnnotations().getMap().isEmpty()) { + hash = (37 * hash) + ANNOTATIONS_FIELD_NUMBER; + hash = (53 * hash) + internalGetAnnotations().hashCode(); + } + hash = (37 * hash) + PARALLELISM_FIELD_NUMBER; + hash = (53 * hash) + getParallelism(); + hash = (37 * hash) + TASK_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getTaskCount(); + if (hasTemplate()) { + hash = (37 * hash) + TEMPLATE_FIELD_NUMBER; + hash = (53 * hash) + getTemplate().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.ExecutionTemplate parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ExecutionTemplate parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ExecutionTemplate parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ExecutionTemplate parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ExecutionTemplate parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ExecutionTemplate parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ExecutionTemplate parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ExecutionTemplate parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ExecutionTemplate parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ExecutionTemplate parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ExecutionTemplate parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ExecutionTemplate parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.ExecutionTemplate prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * ExecutionTemplate describes the data an execution should have when created
+   * from a template.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.ExecutionTemplate} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.ExecutionTemplate) + com.google.cloud.run.v2.ExecutionTemplateOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.ExecutionTemplateProto + .internal_static_google_cloud_run_v2_ExecutionTemplate_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 1: + return internalGetLabels(); + case 2: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 1: + return internalGetMutableLabels(); + case 2: + return internalGetMutableAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.ExecutionTemplateProto + .internal_static_google_cloud_run_v2_ExecutionTemplate_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ExecutionTemplate.class, + com.google.cloud.run.v2.ExecutionTemplate.Builder.class); + } + + // Construct using com.google.cloud.run.v2.ExecutionTemplate.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + internalGetMutableLabels().clear(); + internalGetMutableAnnotations().clear(); + parallelism_ = 0; + + taskCount_ = 0; + + if (templateBuilder_ == null) { + template_ = null; + } else { + template_ = null; + templateBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.ExecutionTemplateProto + .internal_static_google_cloud_run_v2_ExecutionTemplate_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.ExecutionTemplate getDefaultInstanceForType() { + return com.google.cloud.run.v2.ExecutionTemplate.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.ExecutionTemplate build() { + com.google.cloud.run.v2.ExecutionTemplate result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.ExecutionTemplate buildPartial() { + com.google.cloud.run.v2.ExecutionTemplate result = + new com.google.cloud.run.v2.ExecutionTemplate(this); + int from_bitField0_ = bitField0_; + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + result.annotations_ = internalGetAnnotations(); + result.annotations_.makeImmutable(); + result.parallelism_ = parallelism_; + result.taskCount_ = taskCount_; + if (templateBuilder_ == null) { + result.template_ = template_; + } else { + result.template_ = templateBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.ExecutionTemplate) { + return mergeFrom((com.google.cloud.run.v2.ExecutionTemplate) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.ExecutionTemplate other) { + if (other == com.google.cloud.run.v2.ExecutionTemplate.getDefaultInstance()) return this; + internalGetMutableLabels().mergeFrom(other.internalGetLabels()); + internalGetMutableAnnotations().mergeFrom(other.internalGetAnnotations()); + if (other.getParallelism() != 0) { + setParallelism(other.getParallelism()); + } + if (other.getTaskCount() != 0) { + setTaskCount(other.getTaskCount()); + } + if (other.hasTemplate()) { + mergeTemplate(other.getTemplate()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.protobuf.MapEntry labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableLabels() + .getMutableMap() + .put(labels__.getKey(), labels__.getValue()); + break; + } // case 10 + case 18: + { + com.google.protobuf.MapEntry annotations__ = + input.readMessage( + AnnotationsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableAnnotations() + .getMutableMap() + .put(annotations__.getKey(), annotations__.getValue()); + break; + } // case 18 + case 24: + { + parallelism_ = input.readInt32(); + + break; + } // case 24 + case 32: + { + taskCount_ = input.readInt32(); + + break; + } // case 32 + case 42: + { + input.readMessage(getTemplateFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 42 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + private com.google.protobuf.MapField + internalGetMutableLabels() { + onChanged(); + ; + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * 
+ * + * map<string, string> labels = 1; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * 
+ * + * map<string, string> labels = 1; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * 
+ * + * map<string, string> labels = 1; + */ + @java.lang.Override + public java.lang.String getLabelsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * 
+ * + * map<string, string> labels = 1; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearLabels() { + internalGetMutableLabels().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * 
+ * + * map<string, string> labels = 1; + */ + public Builder removeLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableLabels().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableLabels() { + return internalGetMutableLabels().getMutableMap(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * 
+ * + * map<string, string> labels = 1; + */ + public Builder putLabels(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableLabels().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * 
+ * + * map<string, string> labels = 1; + */ + public Builder putAllLabels(java.util.Map values) { + internalGetMutableLabels().getMutableMap().putAll(values); + return this; + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + private com.google.protobuf.MapField + internalGetMutableAnnotations() { + onChanged(); + ; + if (annotations_ == null) { + annotations_ = + com.google.protobuf.MapField.newMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + if (!annotations_.isMutable()) { + annotations_ = annotations_.copy(); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 2; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 2; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 2; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 2; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearAnnotations() { + internalGetMutableAnnotations().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 2; + */ + public Builder removeAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableAnnotations().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableAnnotations() { + return internalGetMutableAnnotations().getMutableMap(); + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 2; + */ + public Builder putAnnotations(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableAnnotations().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 2; + */ + public Builder putAllAnnotations(java.util.Map values) { + internalGetMutableAnnotations().getMutableMap().putAll(values); + return this; + } + + private int parallelism_; + /** + * + * + *
+     * Specifies the maximum desired number of tasks the execution should run at
+     * given time. Must be <= task_count.
+     * When the job is run, if this field is 0 or unset, the maximum possible
+     * value will be used for that execution.
+     * The actual number of tasks running in steady state will be less than this
+     * number when there are fewer tasks waiting to be completed remaining,
+     * i.e. when the work left to do is less than max parallelism.
+     * 
+ * + * int32 parallelism = 3; + * + * @return The parallelism. + */ + @java.lang.Override + public int getParallelism() { + return parallelism_; + } + /** + * + * + *
+     * Specifies the maximum desired number of tasks the execution should run at
+     * given time. Must be <= task_count.
+     * When the job is run, if this field is 0 or unset, the maximum possible
+     * value will be used for that execution.
+     * The actual number of tasks running in steady state will be less than this
+     * number when there are fewer tasks waiting to be completed remaining,
+     * i.e. when the work left to do is less than max parallelism.
+     * 
+ * + * int32 parallelism = 3; + * + * @param value The parallelism to set. + * @return This builder for chaining. + */ + public Builder setParallelism(int value) { + + parallelism_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the maximum desired number of tasks the execution should run at
+     * given time. Must be <= task_count.
+     * When the job is run, if this field is 0 or unset, the maximum possible
+     * value will be used for that execution.
+     * The actual number of tasks running in steady state will be less than this
+     * number when there are fewer tasks waiting to be completed remaining,
+     * i.e. when the work left to do is less than max parallelism.
+     * 
+ * + * int32 parallelism = 3; + * + * @return This builder for chaining. + */ + public Builder clearParallelism() { + + parallelism_ = 0; + onChanged(); + return this; + } + + private int taskCount_; + /** + * + * + *
+     * Specifies the desired number of tasks the execution should run.
+     * Setting to 1 means that parallelism is limited to 1 and the success of
+     * that task signals the success of the execution.
+     * More info:
+     * https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
+     * 
+ * + * int32 task_count = 4; + * + * @return The taskCount. + */ + @java.lang.Override + public int getTaskCount() { + return taskCount_; + } + /** + * + * + *
+     * Specifies the desired number of tasks the execution should run.
+     * Setting to 1 means that parallelism is limited to 1 and the success of
+     * that task signals the success of the execution.
+     * More info:
+     * https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
+     * 
+ * + * int32 task_count = 4; + * + * @param value The taskCount to set. + * @return This builder for chaining. + */ + public Builder setTaskCount(int value) { + + taskCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Specifies the desired number of tasks the execution should run.
+     * Setting to 1 means that parallelism is limited to 1 and the success of
+     * that task signals the success of the execution.
+     * More info:
+     * https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
+     * 
+ * + * int32 task_count = 4; + * + * @return This builder for chaining. + */ + public Builder clearTaskCount() { + + taskCount_ = 0; + onChanged(); + return this; + } + + private com.google.cloud.run.v2.TaskTemplate template_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.TaskTemplate, + com.google.cloud.run.v2.TaskTemplate.Builder, + com.google.cloud.run.v2.TaskTemplateOrBuilder> + templateBuilder_; + /** + * + * + *
+     * Required. Describes the task(s) that will be created when executing an execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the template field is set. + */ + public boolean hasTemplate() { + return templateBuilder_ != null || template_ != null; + } + /** + * + * + *
+     * Required. Describes the task(s) that will be created when executing an execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The template. + */ + public com.google.cloud.run.v2.TaskTemplate getTemplate() { + if (templateBuilder_ == null) { + return template_ == null + ? com.google.cloud.run.v2.TaskTemplate.getDefaultInstance() + : template_; + } else { + return templateBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Describes the task(s) that will be created when executing an execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setTemplate(com.google.cloud.run.v2.TaskTemplate value) { + if (templateBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + template_ = value; + onChanged(); + } else { + templateBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. Describes the task(s) that will be created when executing an execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setTemplate(com.google.cloud.run.v2.TaskTemplate.Builder builderForValue) { + if (templateBuilder_ == null) { + template_ = builderForValue.build(); + onChanged(); + } else { + templateBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. Describes the task(s) that will be created when executing an execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeTemplate(com.google.cloud.run.v2.TaskTemplate value) { + if (templateBuilder_ == null) { + if (template_ != null) { + template_ = + com.google.cloud.run.v2.TaskTemplate.newBuilder(template_) + .mergeFrom(value) + .buildPartial(); + } else { + template_ = value; + } + onChanged(); + } else { + templateBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. Describes the task(s) that will be created when executing an execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearTemplate() { + if (templateBuilder_ == null) { + template_ = null; + onChanged(); + } else { + template_ = null; + templateBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. Describes the task(s) that will be created when executing an execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.run.v2.TaskTemplate.Builder getTemplateBuilder() { + + onChanged(); + return getTemplateFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Describes the task(s) that will be created when executing an execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.run.v2.TaskTemplateOrBuilder getTemplateOrBuilder() { + if (templateBuilder_ != null) { + return templateBuilder_.getMessageOrBuilder(); + } else { + return template_ == null + ? com.google.cloud.run.v2.TaskTemplate.getDefaultInstance() + : template_; + } + } + /** + * + * + *
+     * Required. Describes the task(s) that will be created when executing an execution.
+     * 
+ * + * + * .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.TaskTemplate, + com.google.cloud.run.v2.TaskTemplate.Builder, + com.google.cloud.run.v2.TaskTemplateOrBuilder> + getTemplateFieldBuilder() { + if (templateBuilder_ == null) { + templateBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.TaskTemplate, + com.google.cloud.run.v2.TaskTemplate.Builder, + com.google.cloud.run.v2.TaskTemplateOrBuilder>( + getTemplate(), getParentForChildren(), isClean()); + template_ = null; + } + return templateBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.ExecutionTemplate) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.ExecutionTemplate) + private static final com.google.cloud.run.v2.ExecutionTemplate DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.ExecutionTemplate(); + } + + public static com.google.cloud.run.v2.ExecutionTemplate getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ExecutionTemplate parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.ExecutionTemplate getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionTemplateOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionTemplateOrBuilder.java new file mode 100644 index 000000000000..3a77bccf3a86 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionTemplateOrBuilder.java @@ -0,0 +1,217 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/execution_template.proto + +package com.google.cloud.run.v2; + +public interface ExecutionTemplateOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.ExecutionTemplate) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * KRM-style labels for the resource.
+   * 
+ * + * map<string, string> labels = 1; + */ + int getLabelsCount(); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * 
+ * + * map<string, string> labels = 1; + */ + boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getLabels(); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * 
+ * + * map<string, string> labels = 1; + */ + java.util.Map getLabelsMap(); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * 
+ * + * map<string, string> labels = 1; + */ + + /* nullable */ + java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * 
+ * + * map<string, string> labels = 1; + */ + java.lang.String getLabelsOrThrow(java.lang.String key); + + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 2; + */ + int getAnnotationsCount(); + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 2; + */ + boolean containsAnnotations(java.lang.String key); + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getAnnotations(); + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 2; + */ + java.util.Map getAnnotationsMap(); + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 2; + */ + + /* nullable */ + java.lang.String getAnnotationsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 2; + */ + java.lang.String getAnnotationsOrThrow(java.lang.String key); + + /** + * + * + *
+   * Specifies the maximum desired number of tasks the execution should run at
+   * given time. Must be <= task_count.
+   * When the job is run, if this field is 0 or unset, the maximum possible
+   * value will be used for that execution.
+   * The actual number of tasks running in steady state will be less than this
+   * number when there are fewer tasks waiting to be completed remaining,
+   * i.e. when the work left to do is less than max parallelism.
+   * 
+ * + * int32 parallelism = 3; + * + * @return The parallelism. + */ + int getParallelism(); + + /** + * + * + *
+   * Specifies the desired number of tasks the execution should run.
+   * Setting to 1 means that parallelism is limited to 1 and the success of
+   * that task signals the success of the execution.
+   * More info:
+   * https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
+   * 
+ * + * int32 task_count = 4; + * + * @return The taskCount. + */ + int getTaskCount(); + + /** + * + * + *
+   * Required. Describes the task(s) that will be created when executing an execution.
+   * 
+ * + * .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the template field is set. + */ + boolean hasTemplate(); + /** + * + * + *
+   * Required. Describes the task(s) that will be created when executing an execution.
+   * 
+ * + * .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The template. + */ + com.google.cloud.run.v2.TaskTemplate getTemplate(); + /** + * + * + *
+   * Required. Describes the task(s) that will be created when executing an execution.
+   * 
+ * + * .google.cloud.run.v2.TaskTemplate template = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.run.v2.TaskTemplateOrBuilder getTemplateOrBuilder(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionTemplateProto.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionTemplateProto.java new file mode 100644 index 000000000000..a1643de63edf --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ExecutionTemplateProto.java @@ -0,0 +1,109 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/execution_template.proto + +package com.google.cloud.run.v2; + +public final class ExecutionTemplateProto { + private ExecutionTemplateProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_ExecutionTemplate_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_ExecutionTemplate_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_ExecutionTemplate_LabelsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_ExecutionTemplate_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_ExecutionTemplate_AnnotationsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_ExecutionTemplate_AnnotationsEntry_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n,google/cloud/run/v2/execution_template" + + ".proto\022\023google.cloud.run.v2\032\037google/api/" + + "field_behavior.proto\032\'google/cloud/run/v" + + "2/task_template.proto\"\353\002\n\021ExecutionTempl" + + "ate\022B\n\006labels\030\001 \003(\01322.google.cloud.run.v" + + "2.ExecutionTemplate.LabelsEntry\022L\n\013annot" + + "ations\030\002 \003(\01327.google.cloud.run.v2.Execu" + + "tionTemplate.AnnotationsEntry\022\023\n\013paralle" + + "lism\030\003 \001(\005\022\022\n\ntask_count\030\004 \001(\005\0228\n\010templa" + + "te\030\005 \001(\0132!.google.cloud.run.v2.TaskTempl" + + "ateB\003\340A\002\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005" + + "value\030\002 \001(\t:\0028\001\0322\n\020AnnotationsEntry\022\013\n\003k" + + "ey\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001Bk\n\027com.googl" + + "e.cloud.run.v2B\026ExecutionTemplateProtoP\001" + + "Z6google.golang.org/genproto/googleapis/" + + "cloud/run/v2;runb\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.cloud.run.v2.TaskTemplateProto.getDescriptor(), + }); + internal_static_google_cloud_run_v2_ExecutionTemplate_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_run_v2_ExecutionTemplate_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_ExecutionTemplate_descriptor, + new java.lang.String[] { + "Labels", "Annotations", "Parallelism", "TaskCount", "Template", + }); + internal_static_google_cloud_run_v2_ExecutionTemplate_LabelsEntry_descriptor = + internal_static_google_cloud_run_v2_ExecutionTemplate_descriptor.getNestedTypes().get(0); + internal_static_google_cloud_run_v2_ExecutionTemplate_LabelsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_ExecutionTemplate_LabelsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_cloud_run_v2_ExecutionTemplate_AnnotationsEntry_descriptor = + internal_static_google_cloud_run_v2_ExecutionTemplate_descriptor.getNestedTypes().get(1); + internal_static_google_cloud_run_v2_ExecutionTemplate_AnnotationsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_ExecutionTemplate_AnnotationsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.cloud.run.v2.TaskTemplateProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetExecutionRequest.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetExecutionRequest.java new file mode 100644 index 000000000000..bc809c1d7aa0 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetExecutionRequest.java @@ -0,0 +1,642 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/execution.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Request message for obtaining a Execution by its full name.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.GetExecutionRequest} + */ +public final class GetExecutionRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.GetExecutionRequest) + GetExecutionRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetExecutionRequest.newBuilder() to construct. + private GetExecutionRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetExecutionRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetExecutionRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_GetExecutionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_GetExecutionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.GetExecutionRequest.class, + com.google.cloud.run.v2.GetExecutionRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The full name of the Execution.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The full name of the Execution.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.GetExecutionRequest)) { + return super.equals(obj); + } + com.google.cloud.run.v2.GetExecutionRequest other = + (com.google.cloud.run.v2.GetExecutionRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.GetExecutionRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.GetExecutionRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.GetExecutionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.GetExecutionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.GetExecutionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.GetExecutionRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.GetExecutionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.GetExecutionRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.GetExecutionRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.GetExecutionRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.GetExecutionRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.GetExecutionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.GetExecutionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for obtaining a Execution by its full name.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.GetExecutionRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.GetExecutionRequest) + com.google.cloud.run.v2.GetExecutionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_GetExecutionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_GetExecutionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.GetExecutionRequest.class, + com.google.cloud.run.v2.GetExecutionRequest.Builder.class); + } + + // Construct using com.google.cloud.run.v2.GetExecutionRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_GetExecutionRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.GetExecutionRequest getDefaultInstanceForType() { + return com.google.cloud.run.v2.GetExecutionRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.GetExecutionRequest build() { + com.google.cloud.run.v2.GetExecutionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.GetExecutionRequest buildPartial() { + com.google.cloud.run.v2.GetExecutionRequest result = + new com.google.cloud.run.v2.GetExecutionRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.GetExecutionRequest) { + return mergeFrom((com.google.cloud.run.v2.GetExecutionRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.GetExecutionRequest other) { + if (other == com.google.cloud.run.v2.GetExecutionRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The full name of the Execution.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The full name of the Execution.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The full name of the Execution.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The full name of the Execution.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The full name of the Execution.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.GetExecutionRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.GetExecutionRequest) + private static final com.google.cloud.run.v2.GetExecutionRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.GetExecutionRequest(); + } + + public static com.google.cloud.run.v2.GetExecutionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetExecutionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.GetExecutionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetExecutionRequestOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetExecutionRequestOrBuilder.java new file mode 100644 index 000000000000..ced215d3f290 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetExecutionRequestOrBuilder.java @@ -0,0 +1,58 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/execution.proto + +package com.google.cloud.run.v2; + +public interface GetExecutionRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.GetExecutionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The full name of the Execution.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The full name of the Execution.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetJobRequest.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetJobRequest.java new file mode 100644 index 000000000000..c82537e8e8c5 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetJobRequest.java @@ -0,0 +1,633 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Request message for obtaining a Job by its full name.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.GetJobRequest} + */ +public final class GetJobRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.GetJobRequest) + GetJobRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetJobRequest.newBuilder() to construct. + private GetJobRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetJobRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetJobRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_GetJobRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_GetJobRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.GetJobRequest.class, + com.google.cloud.run.v2.GetJobRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The full name of the Job.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The full name of the Job.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.GetJobRequest)) { + return super.equals(obj); + } + com.google.cloud.run.v2.GetJobRequest other = (com.google.cloud.run.v2.GetJobRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.GetJobRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.GetJobRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.GetJobRequest parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.GetJobRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.GetJobRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.GetJobRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.GetJobRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.GetJobRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.GetJobRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.GetJobRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.GetJobRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.GetJobRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.GetJobRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for obtaining a Job by its full name.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.GetJobRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.GetJobRequest) + com.google.cloud.run.v2.GetJobRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_GetJobRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_GetJobRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.GetJobRequest.class, + com.google.cloud.run.v2.GetJobRequest.Builder.class); + } + + // Construct using com.google.cloud.run.v2.GetJobRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_GetJobRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.GetJobRequest getDefaultInstanceForType() { + return com.google.cloud.run.v2.GetJobRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.GetJobRequest build() { + com.google.cloud.run.v2.GetJobRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.GetJobRequest buildPartial() { + com.google.cloud.run.v2.GetJobRequest result = + new com.google.cloud.run.v2.GetJobRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.GetJobRequest) { + return mergeFrom((com.google.cloud.run.v2.GetJobRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.GetJobRequest other) { + if (other == com.google.cloud.run.v2.GetJobRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The full name of the Job.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The full name of the Job.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The full name of the Job.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The full name of the Job.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The full name of the Job.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.GetJobRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.GetJobRequest) + private static final com.google.cloud.run.v2.GetJobRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.GetJobRequest(); + } + + public static com.google.cloud.run.v2.GetJobRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetJobRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.GetJobRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetJobRequestOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetJobRequestOrBuilder.java new file mode 100644 index 000000000000..78d2469ac30d --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetJobRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +public interface GetJobRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.GetJobRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The full name of the Job.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The full name of the Job.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetTaskRequest.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetTaskRequest.java new file mode 100644 index 000000000000..818c01e8ef26 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetTaskRequest.java @@ -0,0 +1,641 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/task.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Request message for obtaining a Task by its full name.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.GetTaskRequest} + */ +public final class GetTaskRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.GetTaskRequest) + GetTaskRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetTaskRequest.newBuilder() to construct. + private GetTaskRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetTaskRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetTaskRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_GetTaskRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_GetTaskRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.GetTaskRequest.class, + com.google.cloud.run.v2.GetTaskRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The full name of the Task.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The full name of the Task.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.GetTaskRequest)) { + return super.equals(obj); + } + com.google.cloud.run.v2.GetTaskRequest other = (com.google.cloud.run.v2.GetTaskRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.GetTaskRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.GetTaskRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.GetTaskRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.GetTaskRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.GetTaskRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.GetTaskRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.GetTaskRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.GetTaskRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.GetTaskRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.GetTaskRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.GetTaskRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.GetTaskRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.GetTaskRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for obtaining a Task by its full name.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.GetTaskRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.GetTaskRequest) + com.google.cloud.run.v2.GetTaskRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_GetTaskRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_GetTaskRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.GetTaskRequest.class, + com.google.cloud.run.v2.GetTaskRequest.Builder.class); + } + + // Construct using com.google.cloud.run.v2.GetTaskRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_GetTaskRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.GetTaskRequest getDefaultInstanceForType() { + return com.google.cloud.run.v2.GetTaskRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.GetTaskRequest build() { + com.google.cloud.run.v2.GetTaskRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.GetTaskRequest buildPartial() { + com.google.cloud.run.v2.GetTaskRequest result = + new com.google.cloud.run.v2.GetTaskRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.GetTaskRequest) { + return mergeFrom((com.google.cloud.run.v2.GetTaskRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.GetTaskRequest other) { + if (other == com.google.cloud.run.v2.GetTaskRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The full name of the Task.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The full name of the Task.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The full name of the Task.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The full name of the Task.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The full name of the Task.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.GetTaskRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.GetTaskRequest) + private static final com.google.cloud.run.v2.GetTaskRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.GetTaskRequest(); + } + + public static com.google.cloud.run.v2.GetTaskRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetTaskRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.GetTaskRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetTaskRequestOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetTaskRequestOrBuilder.java new file mode 100644 index 000000000000..be81363612a2 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/GetTaskRequestOrBuilder.java @@ -0,0 +1,58 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/task.proto + +package com.google.cloud.run.v2; + +public interface GetTaskRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.GetTaskRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The full name of the Task.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The full name of the Task.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/Job.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/Job.java new file mode 100644 index 000000000000..740f72879d95 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/Job.java @@ -0,0 +1,5995 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Job represents the configuration of a single job. A job an immutable resource
+ * that references a container image which is run to completion.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.Job} + */ +public final class Job extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.Job) + JobOrBuilder { + private static final long serialVersionUID = 0L; + // Use Job.newBuilder() to construct. + private Job(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Job() { + name_ = ""; + uid_ = ""; + creator_ = ""; + lastModifier_ = ""; + client_ = ""; + clientVersion_ = ""; + launchStage_ = 0; + conditions_ = java.util.Collections.emptyList(); + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Job(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto.internal_static_google_cloud_run_v2_Job_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 4: + return internalGetLabels(); + case 5: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_Job_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.Job.class, com.google.cloud.run.v2.Job.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * The fully qualified name of this Job.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * The fully qualified name of this Job.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int UID_FIELD_NUMBER = 2; + private volatile java.lang.Object uid_; + /** + * + * + *
+   * Output only. Server assigned unique identifier for the Execution. The value is a UUID4
+   * string and guaranteed to remain unchanged until the resource is deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + @java.lang.Override + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Server assigned unique identifier for the Execution. The value is a UUID4
+   * string and guaranteed to remain unchanged until the resource is deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int GENERATION_FIELD_NUMBER = 3; + private long generation_; + /** + * + * + *
+   * Output only. A number that monotonically increases every time the user
+   * modifies the desired state.
+   * 
+ * + * int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The generation. + */ + @java.lang.Override + public long getGeneration() { + return generation_; + } + + public static final int LABELS_FIELD_NUMBER = 4; + + private static final class LabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_Job_LabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int ANNOTATIONS_FIELD_NUMBER = 5; + + private static final class AnnotationsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_Job_AnnotationsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+   * KRM-style annotations for the resource. Unstructured key value map that may
+   * be set by external tools to store and arbitrary metadata.
+   * They are not queryable and should be preserved
+   * when modifying objects. Cloud Run will populate some annotations using
+   * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+   * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+   * https://kubernetes.io/docs/user-guide/annotations
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+   * KRM-style annotations for the resource. Unstructured key value map that may
+   * be set by external tools to store and arbitrary metadata.
+   * They are not queryable and should be preserved
+   * when modifying objects. Cloud Run will populate some annotations using
+   * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+   * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+   * https://kubernetes.io/docs/user-guide/annotations
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+   * KRM-style annotations for the resource. Unstructured key value map that may
+   * be set by external tools to store and arbitrary metadata.
+   * They are not queryable and should be preserved
+   * when modifying objects. Cloud Run will populate some annotations using
+   * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+   * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+   * https://kubernetes.io/docs/user-guide/annotations
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * KRM-style annotations for the resource. Unstructured key value map that may
+   * be set by external tools to store and arbitrary metadata.
+   * They are not queryable and should be preserved
+   * when modifying objects. Cloud Run will populate some annotations using
+   * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+   * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+   * https://kubernetes.io/docs/user-guide/annotations
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int CREATE_TIME_FIELD_NUMBER = 6; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Output only. The creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Output only. The creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Output only. The creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 7; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + public static final int DELETE_TIME_FIELD_NUMBER = 8; + private com.google.protobuf.Timestamp deleteTime_; + /** + * + * + *
+   * Output only. The deletion time.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + @java.lang.Override + public boolean hasDeleteTime() { + return deleteTime_ != null; + } + /** + * + * + *
+   * Output only. The deletion time.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getDeleteTime() { + return deleteTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : deleteTime_; + } + /** + * + * + *
+   * Output only. The deletion time.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + return getDeleteTime(); + } + + public static final int EXPIRE_TIME_FIELD_NUMBER = 9; + private com.google.protobuf.Timestamp expireTime_; + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + @java.lang.Override + public boolean hasExpireTime() { + return expireTime_ != null; + } + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getExpireTime() { + return expireTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : expireTime_; + } + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + return getExpireTime(); + } + + public static final int CREATOR_FIELD_NUMBER = 10; + private volatile java.lang.Object creator_; + /** + * + * + *
+   * Output only. Email address of the authenticated creator.
+   * 
+ * + * string creator = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The creator. + */ + @java.lang.Override + public java.lang.String getCreator() { + java.lang.Object ref = creator_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + creator_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Email address of the authenticated creator.
+   * 
+ * + * string creator = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for creator. + */ + @java.lang.Override + public com.google.protobuf.ByteString getCreatorBytes() { + java.lang.Object ref = creator_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + creator_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LAST_MODIFIER_FIELD_NUMBER = 11; + private volatile java.lang.Object lastModifier_; + /** + * + * + *
+   * Output only. Email address of the last authenticated modifier.
+   * 
+ * + * string last_modifier = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The lastModifier. + */ + @java.lang.Override + public java.lang.String getLastModifier() { + java.lang.Object ref = lastModifier_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + lastModifier_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Email address of the last authenticated modifier.
+   * 
+ * + * string last_modifier = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for lastModifier. + */ + @java.lang.Override + public com.google.protobuf.ByteString getLastModifierBytes() { + java.lang.Object ref = lastModifier_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + lastModifier_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CLIENT_FIELD_NUMBER = 12; + private volatile java.lang.Object client_; + /** + * + * + *
+   * Arbitrary identifier for the API client.
+   * 
+ * + * string client = 12; + * + * @return The client. + */ + @java.lang.Override + public java.lang.String getClient() { + java.lang.Object ref = client_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + client_ = s; + return s; + } + } + /** + * + * + *
+   * Arbitrary identifier for the API client.
+   * 
+ * + * string client = 12; + * + * @return The bytes for client. + */ + @java.lang.Override + public com.google.protobuf.ByteString getClientBytes() { + java.lang.Object ref = client_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + client_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CLIENT_VERSION_FIELD_NUMBER = 13; + private volatile java.lang.Object clientVersion_; + /** + * + * + *
+   * Arbitrary version identifier for the API client.
+   * 
+ * + * string client_version = 13; + * + * @return The clientVersion. + */ + @java.lang.Override + public java.lang.String getClientVersion() { + java.lang.Object ref = clientVersion_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientVersion_ = s; + return s; + } + } + /** + * + * + *
+   * Arbitrary version identifier for the API client.
+   * 
+ * + * string client_version = 13; + * + * @return The bytes for clientVersion. + */ + @java.lang.Override + public com.google.protobuf.ByteString getClientVersionBytes() { + java.lang.Object ref = clientVersion_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + clientVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LAUNCH_STAGE_FIELD_NUMBER = 14; + private int launchStage_; + /** + * + * + *
+   * The launch stage as defined by [Google Cloud Platform
+   * Launch Stages](https://cloud.google.com/terms/launch-stages).
+   * Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
+   * is assumed.
+   * 
+ * + * .google.api.LaunchStage launch_stage = 14; + * + * @return The enum numeric value on the wire for launchStage. + */ + @java.lang.Override + public int getLaunchStageValue() { + return launchStage_; + } + /** + * + * + *
+   * The launch stage as defined by [Google Cloud Platform
+   * Launch Stages](https://cloud.google.com/terms/launch-stages).
+   * Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
+   * is assumed.
+   * 
+ * + * .google.api.LaunchStage launch_stage = 14; + * + * @return The launchStage. + */ + @java.lang.Override + public com.google.api.LaunchStage getLaunchStage() { + @SuppressWarnings("deprecation") + com.google.api.LaunchStage result = com.google.api.LaunchStage.valueOf(launchStage_); + return result == null ? com.google.api.LaunchStage.UNRECOGNIZED : result; + } + + public static final int BINARY_AUTHORIZATION_FIELD_NUMBER = 15; + private com.google.cloud.run.v2.BinaryAuthorization binaryAuthorization_; + /** + * + * + *
+   * Settings for the Binary Authorization feature.
+   * 
+ * + * .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + * + * @return Whether the binaryAuthorization field is set. + */ + @java.lang.Override + public boolean hasBinaryAuthorization() { + return binaryAuthorization_ != null; + } + /** + * + * + *
+   * Settings for the Binary Authorization feature.
+   * 
+ * + * .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + * + * @return The binaryAuthorization. + */ + @java.lang.Override + public com.google.cloud.run.v2.BinaryAuthorization getBinaryAuthorization() { + return binaryAuthorization_ == null + ? com.google.cloud.run.v2.BinaryAuthorization.getDefaultInstance() + : binaryAuthorization_; + } + /** + * + * + *
+   * Settings for the Binary Authorization feature.
+   * 
+ * + * .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + */ + @java.lang.Override + public com.google.cloud.run.v2.BinaryAuthorizationOrBuilder getBinaryAuthorizationOrBuilder() { + return getBinaryAuthorization(); + } + + public static final int TEMPLATE_FIELD_NUMBER = 16; + private com.google.cloud.run.v2.ExecutionTemplate template_; + /** + * + * + *
+   * Required. The template used to create executions for this Job.
+   * 
+ * + * + * .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the template field is set. + */ + @java.lang.Override + public boolean hasTemplate() { + return template_ != null; + } + /** + * + * + *
+   * Required. The template used to create executions for this Job.
+   * 
+ * + * + * .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The template. + */ + @java.lang.Override + public com.google.cloud.run.v2.ExecutionTemplate getTemplate() { + return template_ == null + ? com.google.cloud.run.v2.ExecutionTemplate.getDefaultInstance() + : template_; + } + /** + * + * + *
+   * Required. The template used to create executions for this Job.
+   * 
+ * + * + * .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.run.v2.ExecutionTemplateOrBuilder getTemplateOrBuilder() { + return getTemplate(); + } + + public static final int OBSERVED_GENERATION_FIELD_NUMBER = 17; + private long observedGeneration_; + /** + * + * + *
+   * Output only. The generation of this Job. See comments in `reconciling` for additional
+   * information on reconciliation process in Cloud Run.
+   * 
+ * + * int64 observed_generation = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The observedGeneration. + */ + @java.lang.Override + public long getObservedGeneration() { + return observedGeneration_; + } + + public static final int TERMINAL_CONDITION_FIELD_NUMBER = 18; + private com.google.cloud.run.v2.Condition terminalCondition_; + /** + * + * + *
+   * Output only. The Condition of this Job, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the terminalCondition field is set. + */ + @java.lang.Override + public boolean hasTerminalCondition() { + return terminalCondition_ != null; + } + /** + * + * + *
+   * Output only. The Condition of this Job, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The terminalCondition. + */ + @java.lang.Override + public com.google.cloud.run.v2.Condition getTerminalCondition() { + return terminalCondition_ == null + ? com.google.cloud.run.v2.Condition.getDefaultInstance() + : terminalCondition_; + } + /** + * + * + *
+   * Output only. The Condition of this Job, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.run.v2.ConditionOrBuilder getTerminalConditionOrBuilder() { + return getTerminalCondition(); + } + + public static final int CONDITIONS_FIELD_NUMBER = 19; + private java.util.List conditions_; + /** + * + * + *
+   * Output only. The Conditions of all other associated sub-resources. They contain
+   * additional diagnostics information in case the Job does not reach its
+   * desired state. See comments in `reconciling` for additional information on
+   * reconciliation process in Cloud Run.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.List getConditionsList() { + return conditions_; + } + /** + * + * + *
+   * Output only. The Conditions of all other associated sub-resources. They contain
+   * additional diagnostics information in case the Job does not reach its
+   * desired state. See comments in `reconciling` for additional information on
+   * reconciliation process in Cloud Run.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.List + getConditionsOrBuilderList() { + return conditions_; + } + /** + * + * + *
+   * Output only. The Conditions of all other associated sub-resources. They contain
+   * additional diagnostics information in case the Job does not reach its
+   * desired state. See comments in `reconciling` for additional information on
+   * reconciliation process in Cloud Run.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public int getConditionsCount() { + return conditions_.size(); + } + /** + * + * + *
+   * Output only. The Conditions of all other associated sub-resources. They contain
+   * additional diagnostics information in case the Job does not reach its
+   * desired state. See comments in `reconciling` for additional information on
+   * reconciliation process in Cloud Run.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.run.v2.Condition getConditions(int index) { + return conditions_.get(index); + } + /** + * + * + *
+   * Output only. The Conditions of all other associated sub-resources. They contain
+   * additional diagnostics information in case the Job does not reach its
+   * desired state. See comments in `reconciling` for additional information on
+   * reconciliation process in Cloud Run.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.run.v2.ConditionOrBuilder getConditionsOrBuilder(int index) { + return conditions_.get(index); + } + + public static final int EXECUTION_COUNT_FIELD_NUMBER = 20; + private int executionCount_; + /** + * + * + *
+   * Output only. Number of executions created for this job.
+   * 
+ * + * int32 execution_count = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The executionCount. + */ + @java.lang.Override + public int getExecutionCount() { + return executionCount_; + } + + public static final int LATEST_CREATED_EXECUTION_FIELD_NUMBER = 22; + private com.google.cloud.run.v2.ExecutionReference latestCreatedExecution_; + /** + * + * + *
+   * Output only. Name of the last created execution.
+   * 
+ * + * + * .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the latestCreatedExecution field is set. + */ + @java.lang.Override + public boolean hasLatestCreatedExecution() { + return latestCreatedExecution_ != null; + } + /** + * + * + *
+   * Output only. Name of the last created execution.
+   * 
+ * + * + * .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The latestCreatedExecution. + */ + @java.lang.Override + public com.google.cloud.run.v2.ExecutionReference getLatestCreatedExecution() { + return latestCreatedExecution_ == null + ? com.google.cloud.run.v2.ExecutionReference.getDefaultInstance() + : latestCreatedExecution_; + } + /** + * + * + *
+   * Output only. Name of the last created execution.
+   * 
+ * + * + * .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.run.v2.ExecutionReferenceOrBuilder getLatestCreatedExecutionOrBuilder() { + return getLatestCreatedExecution(); + } + + public static final int RECONCILING_FIELD_NUMBER = 23; + private boolean reconciling_; + /** + * + * + *
+   * Output only. Returns true if the Job is currently being acted upon by the system to
+   * bring it into the desired state.
+   * When a new Job is created, or an existing one is updated, Cloud Run
+   * will asynchronously perform all necessary steps to bring the Job to the
+   * desired state. This process is called reconciliation.
+   * While reconciliation is in process, `observed_generation` and
+   * `latest_succeeded_execution`, will have transient values that might
+   * mismatch the intended state: Once reconciliation is over (and this field is
+   * false), there are two possible outcomes: reconciliation succeeded and the
+   * state matches the Job, or there was an error,  and reconciliation failed.
+   * This state can be found in `terminal_condition.state`.
+   * If reconciliation succeeded, the following fields will match:
+   * `observed_generation` and `generation`, `latest_succeeded_execution` and
+   * `latest_created_execution`.
+   * If reconciliation failed, `observed_generation` and
+   * `latest_succeeded_execution` will have the state of the last succeeded
+   * execution or empty for newly created Job. Additional information on the
+   * failure can be found in `terminal_condition` and `conditions`.
+   * 
+ * + * bool reconciling = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + @java.lang.Override + public boolean getReconciling() { + return reconciling_; + } + + public static final int ETAG_FIELD_NUMBER = 99; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * Output only. A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uid_); + } + if (generation_ != 0L) { + output.writeInt64(3, generation_); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 4); + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetAnnotations(), AnnotationsDefaultEntryHolder.defaultEntry, 5); + if (createTime_ != null) { + output.writeMessage(6, getCreateTime()); + } + if (updateTime_ != null) { + output.writeMessage(7, getUpdateTime()); + } + if (deleteTime_ != null) { + output.writeMessage(8, getDeleteTime()); + } + if (expireTime_ != null) { + output.writeMessage(9, getExpireTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(creator_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 10, creator_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(lastModifier_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 11, lastModifier_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(client_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 12, client_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(clientVersion_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 13, clientVersion_); + } + if (launchStage_ != com.google.api.LaunchStage.LAUNCH_STAGE_UNSPECIFIED.getNumber()) { + output.writeEnum(14, launchStage_); + } + if (binaryAuthorization_ != null) { + output.writeMessage(15, getBinaryAuthorization()); + } + if (template_ != null) { + output.writeMessage(16, getTemplate()); + } + if (observedGeneration_ != 0L) { + output.writeInt64(17, observedGeneration_); + } + if (terminalCondition_ != null) { + output.writeMessage(18, getTerminalCondition()); + } + for (int i = 0; i < conditions_.size(); i++) { + output.writeMessage(19, conditions_.get(i)); + } + if (executionCount_ != 0) { + output.writeInt32(20, executionCount_); + } + if (latestCreatedExecution_ != null) { + output.writeMessage(22, getLatestCreatedExecution()); + } + if (reconciling_ != false) { + output.writeBool(23, reconciling_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 99, etag_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uid_); + } + if (generation_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, generation_); + } + for (java.util.Map.Entry entry : + internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry labels__ = + LabelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, labels__); + } + for (java.util.Map.Entry entry : + internalGetAnnotations().getMap().entrySet()) { + com.google.protobuf.MapEntry annotations__ = + AnnotationsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, annotations__); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getCreateTime()); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getUpdateTime()); + } + if (deleteTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getDeleteTime()); + } + if (expireTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getExpireTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(creator_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(10, creator_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(lastModifier_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(11, lastModifier_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(client_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(12, client_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(clientVersion_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(13, clientVersion_); + } + if (launchStage_ != com.google.api.LaunchStage.LAUNCH_STAGE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(14, launchStage_); + } + if (binaryAuthorization_ != null) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(15, getBinaryAuthorization()); + } + if (template_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(16, getTemplate()); + } + if (observedGeneration_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(17, observedGeneration_); + } + if (terminalCondition_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(18, getTerminalCondition()); + } + for (int i = 0; i < conditions_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(19, conditions_.get(i)); + } + if (executionCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(20, executionCount_); + } + if (latestCreatedExecution_ != null) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(22, getLatestCreatedExecution()); + } + if (reconciling_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(23, reconciling_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(99, etag_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.Job)) { + return super.equals(obj); + } + com.google.cloud.run.v2.Job other = (com.google.cloud.run.v2.Job) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUid().equals(other.getUid())) return false; + if (getGeneration() != other.getGeneration()) return false; + if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (!internalGetAnnotations().equals(other.internalGetAnnotations())) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (hasDeleteTime() != other.hasDeleteTime()) return false; + if (hasDeleteTime()) { + if (!getDeleteTime().equals(other.getDeleteTime())) return false; + } + if (hasExpireTime() != other.hasExpireTime()) return false; + if (hasExpireTime()) { + if (!getExpireTime().equals(other.getExpireTime())) return false; + } + if (!getCreator().equals(other.getCreator())) return false; + if (!getLastModifier().equals(other.getLastModifier())) return false; + if (!getClient().equals(other.getClient())) return false; + if (!getClientVersion().equals(other.getClientVersion())) return false; + if (launchStage_ != other.launchStage_) return false; + if (hasBinaryAuthorization() != other.hasBinaryAuthorization()) return false; + if (hasBinaryAuthorization()) { + if (!getBinaryAuthorization().equals(other.getBinaryAuthorization())) return false; + } + if (hasTemplate() != other.hasTemplate()) return false; + if (hasTemplate()) { + if (!getTemplate().equals(other.getTemplate())) return false; + } + if (getObservedGeneration() != other.getObservedGeneration()) return false; + if (hasTerminalCondition() != other.hasTerminalCondition()) return false; + if (hasTerminalCondition()) { + if (!getTerminalCondition().equals(other.getTerminalCondition())) return false; + } + if (!getConditionsList().equals(other.getConditionsList())) return false; + if (getExecutionCount() != other.getExecutionCount()) return false; + if (hasLatestCreatedExecution() != other.hasLatestCreatedExecution()) return false; + if (hasLatestCreatedExecution()) { + if (!getLatestCreatedExecution().equals(other.getLatestCreatedExecution())) return false; + } + if (getReconciling() != other.getReconciling()) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + UID_FIELD_NUMBER; + hash = (53 * hash) + getUid().hashCode(); + hash = (37 * hash) + GENERATION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getGeneration()); + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + if (!internalGetAnnotations().getMap().isEmpty()) { + hash = (37 * hash) + ANNOTATIONS_FIELD_NUMBER; + hash = (53 * hash) + internalGetAnnotations().hashCode(); + } + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + if (hasDeleteTime()) { + hash = (37 * hash) + DELETE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getDeleteTime().hashCode(); + } + if (hasExpireTime()) { + hash = (37 * hash) + EXPIRE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getExpireTime().hashCode(); + } + hash = (37 * hash) + CREATOR_FIELD_NUMBER; + hash = (53 * hash) + getCreator().hashCode(); + hash = (37 * hash) + LAST_MODIFIER_FIELD_NUMBER; + hash = (53 * hash) + getLastModifier().hashCode(); + hash = (37 * hash) + CLIENT_FIELD_NUMBER; + hash = (53 * hash) + getClient().hashCode(); + hash = (37 * hash) + CLIENT_VERSION_FIELD_NUMBER; + hash = (53 * hash) + getClientVersion().hashCode(); + hash = (37 * hash) + LAUNCH_STAGE_FIELD_NUMBER; + hash = (53 * hash) + launchStage_; + if (hasBinaryAuthorization()) { + hash = (37 * hash) + BINARY_AUTHORIZATION_FIELD_NUMBER; + hash = (53 * hash) + getBinaryAuthorization().hashCode(); + } + if (hasTemplate()) { + hash = (37 * hash) + TEMPLATE_FIELD_NUMBER; + hash = (53 * hash) + getTemplate().hashCode(); + } + hash = (37 * hash) + OBSERVED_GENERATION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getObservedGeneration()); + if (hasTerminalCondition()) { + hash = (37 * hash) + TERMINAL_CONDITION_FIELD_NUMBER; + hash = (53 * hash) + getTerminalCondition().hashCode(); + } + if (getConditionsCount() > 0) { + hash = (37 * hash) + CONDITIONS_FIELD_NUMBER; + hash = (53 * hash) + getConditionsList().hashCode(); + } + hash = (37 * hash) + EXECUTION_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getExecutionCount(); + if (hasLatestCreatedExecution()) { + hash = (37 * hash) + LATEST_CREATED_EXECUTION_FIELD_NUMBER; + hash = (53 * hash) + getLatestCreatedExecution().hashCode(); + } + hash = (37 * hash) + RECONCILING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getReconciling()); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.Job parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.Job parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.Job parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.Job parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.Job parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.Job parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.Job parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.Job parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.Job parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.Job parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.Job parseFrom(com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.Job parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.Job prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Job represents the configuration of a single job. A job an immutable resource
+   * that references a container image which is run to completion.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.Job} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.Job) + com.google.cloud.run.v2.JobOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto.internal_static_google_cloud_run_v2_Job_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 4: + return internalGetLabels(); + case 5: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 4: + return internalGetMutableLabels(); + case 5: + return internalGetMutableAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_Job_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.Job.class, com.google.cloud.run.v2.Job.Builder.class); + } + + // Construct using com.google.cloud.run.v2.Job.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + uid_ = ""; + + generation_ = 0L; + + internalGetMutableLabels().clear(); + internalGetMutableAnnotations().clear(); + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + if (expireTimeBuilder_ == null) { + expireTime_ = null; + } else { + expireTime_ = null; + expireTimeBuilder_ = null; + } + creator_ = ""; + + lastModifier_ = ""; + + client_ = ""; + + clientVersion_ = ""; + + launchStage_ = 0; + + if (binaryAuthorizationBuilder_ == null) { + binaryAuthorization_ = null; + } else { + binaryAuthorization_ = null; + binaryAuthorizationBuilder_ = null; + } + if (templateBuilder_ == null) { + template_ = null; + } else { + template_ = null; + templateBuilder_ = null; + } + observedGeneration_ = 0L; + + if (terminalConditionBuilder_ == null) { + terminalCondition_ = null; + } else { + terminalCondition_ = null; + terminalConditionBuilder_ = null; + } + if (conditionsBuilder_ == null) { + conditions_ = java.util.Collections.emptyList(); + } else { + conditions_ = null; + conditionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + executionCount_ = 0; + + if (latestCreatedExecutionBuilder_ == null) { + latestCreatedExecution_ = null; + } else { + latestCreatedExecution_ = null; + latestCreatedExecutionBuilder_ = null; + } + reconciling_ = false; + + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.JobProto.internal_static_google_cloud_run_v2_Job_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.Job getDefaultInstanceForType() { + return com.google.cloud.run.v2.Job.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.Job build() { + com.google.cloud.run.v2.Job result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.Job buildPartial() { + com.google.cloud.run.v2.Job result = new com.google.cloud.run.v2.Job(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.uid_ = uid_; + result.generation_ = generation_; + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + result.annotations_ = internalGetAnnotations(); + result.annotations_.makeImmutable(); + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + if (deleteTimeBuilder_ == null) { + result.deleteTime_ = deleteTime_; + } else { + result.deleteTime_ = deleteTimeBuilder_.build(); + } + if (expireTimeBuilder_ == null) { + result.expireTime_ = expireTime_; + } else { + result.expireTime_ = expireTimeBuilder_.build(); + } + result.creator_ = creator_; + result.lastModifier_ = lastModifier_; + result.client_ = client_; + result.clientVersion_ = clientVersion_; + result.launchStage_ = launchStage_; + if (binaryAuthorizationBuilder_ == null) { + result.binaryAuthorization_ = binaryAuthorization_; + } else { + result.binaryAuthorization_ = binaryAuthorizationBuilder_.build(); + } + if (templateBuilder_ == null) { + result.template_ = template_; + } else { + result.template_ = templateBuilder_.build(); + } + result.observedGeneration_ = observedGeneration_; + if (terminalConditionBuilder_ == null) { + result.terminalCondition_ = terminalCondition_; + } else { + result.terminalCondition_ = terminalConditionBuilder_.build(); + } + if (conditionsBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0)) { + conditions_ = java.util.Collections.unmodifiableList(conditions_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.conditions_ = conditions_; + } else { + result.conditions_ = conditionsBuilder_.build(); + } + result.executionCount_ = executionCount_; + if (latestCreatedExecutionBuilder_ == null) { + result.latestCreatedExecution_ = latestCreatedExecution_; + } else { + result.latestCreatedExecution_ = latestCreatedExecutionBuilder_.build(); + } + result.reconciling_ = reconciling_; + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.Job) { + return mergeFrom((com.google.cloud.run.v2.Job) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.Job other) { + if (other == com.google.cloud.run.v2.Job.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getUid().isEmpty()) { + uid_ = other.uid_; + onChanged(); + } + if (other.getGeneration() != 0L) { + setGeneration(other.getGeneration()); + } + internalGetMutableLabels().mergeFrom(other.internalGetLabels()); + internalGetMutableAnnotations().mergeFrom(other.internalGetAnnotations()); + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + if (other.hasDeleteTime()) { + mergeDeleteTime(other.getDeleteTime()); + } + if (other.hasExpireTime()) { + mergeExpireTime(other.getExpireTime()); + } + if (!other.getCreator().isEmpty()) { + creator_ = other.creator_; + onChanged(); + } + if (!other.getLastModifier().isEmpty()) { + lastModifier_ = other.lastModifier_; + onChanged(); + } + if (!other.getClient().isEmpty()) { + client_ = other.client_; + onChanged(); + } + if (!other.getClientVersion().isEmpty()) { + clientVersion_ = other.clientVersion_; + onChanged(); + } + if (other.launchStage_ != 0) { + setLaunchStageValue(other.getLaunchStageValue()); + } + if (other.hasBinaryAuthorization()) { + mergeBinaryAuthorization(other.getBinaryAuthorization()); + } + if (other.hasTemplate()) { + mergeTemplate(other.getTemplate()); + } + if (other.getObservedGeneration() != 0L) { + setObservedGeneration(other.getObservedGeneration()); + } + if (other.hasTerminalCondition()) { + mergeTerminalCondition(other.getTerminalCondition()); + } + if (conditionsBuilder_ == null) { + if (!other.conditions_.isEmpty()) { + if (conditions_.isEmpty()) { + conditions_ = other.conditions_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureConditionsIsMutable(); + conditions_.addAll(other.conditions_); + } + onChanged(); + } + } else { + if (!other.conditions_.isEmpty()) { + if (conditionsBuilder_.isEmpty()) { + conditionsBuilder_.dispose(); + conditionsBuilder_ = null; + conditions_ = other.conditions_; + bitField0_ = (bitField0_ & ~0x00000004); + conditionsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getConditionsFieldBuilder() + : null; + } else { + conditionsBuilder_.addAllMessages(other.conditions_); + } + } + } + if (other.getExecutionCount() != 0) { + setExecutionCount(other.getExecutionCount()); + } + if (other.hasLatestCreatedExecution()) { + mergeLatestCreatedExecution(other.getLatestCreatedExecution()); + } + if (other.getReconciling() != false) { + setReconciling(other.getReconciling()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + uid_ = input.readStringRequireUtf8(); + + break; + } // case 18 + case 24: + { + generation_ = input.readInt64(); + + break; + } // case 24 + case 34: + { + com.google.protobuf.MapEntry labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableLabels() + .getMutableMap() + .put(labels__.getKey(), labels__.getValue()); + break; + } // case 34 + case 42: + { + com.google.protobuf.MapEntry annotations__ = + input.readMessage( + AnnotationsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableAnnotations() + .getMutableMap() + .put(annotations__.getKey(), annotations__.getValue()); + break; + } // case 42 + case 50: + { + input.readMessage(getCreateTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 50 + case 58: + { + input.readMessage(getUpdateTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 58 + case 66: + { + input.readMessage(getDeleteTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 66 + case 74: + { + input.readMessage(getExpireTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 74 + case 82: + { + creator_ = input.readStringRequireUtf8(); + + break; + } // case 82 + case 90: + { + lastModifier_ = input.readStringRequireUtf8(); + + break; + } // case 90 + case 98: + { + client_ = input.readStringRequireUtf8(); + + break; + } // case 98 + case 106: + { + clientVersion_ = input.readStringRequireUtf8(); + + break; + } // case 106 + case 112: + { + launchStage_ = input.readEnum(); + + break; + } // case 112 + case 122: + { + input.readMessage( + getBinaryAuthorizationFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 122 + case 130: + { + input.readMessage(getTemplateFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 130 + case 136: + { + observedGeneration_ = input.readInt64(); + + break; + } // case 136 + case 146: + { + input.readMessage( + getTerminalConditionFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 146 + case 154: + { + com.google.cloud.run.v2.Condition m = + input.readMessage( + com.google.cloud.run.v2.Condition.parser(), extensionRegistry); + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + conditions_.add(m); + } else { + conditionsBuilder_.addMessage(m); + } + break; + } // case 154 + case 160: + { + executionCount_ = input.readInt32(); + + break; + } // case 160 + case 178: + { + input.readMessage( + getLatestCreatedExecutionFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 178 + case 184: + { + reconciling_ = input.readBool(); + + break; + } // case 184 + case 794: + { + etag_ = input.readStringRequireUtf8(); + + break; + } // case 794 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The fully qualified name of this Job.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * string name = 1; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The fully qualified name of this Job.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The fully qualified name of this Job.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * string name = 1; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The fully qualified name of this Job.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * string name = 1; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The fully qualified name of this Job.
+     * Format:
+     * projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * string name = 1; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object uid_ = ""; + /** + * + * + *
+     * Output only. Server assigned unique identifier for the Execution. The value is a UUID4
+     * string and guaranteed to remain unchanged until the resource is deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the Execution. The value is a UUID4
+     * string and guaranteed to remain unchanged until the resource is deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the Execution. The value is a UUID4
+     * string and guaranteed to remain unchanged until the resource is deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The uid to set. + * @return This builder for chaining. + */ + public Builder setUid(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uid_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the Execution. The value is a UUID4
+     * string and guaranteed to remain unchanged until the resource is deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearUid() { + + uid_ = getDefaultInstance().getUid(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the Execution. The value is a UUID4
+     * string and guaranteed to remain unchanged until the resource is deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for uid to set. + * @return This builder for chaining. + */ + public Builder setUidBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uid_ = value; + onChanged(); + return this; + } + + private long generation_; + /** + * + * + *
+     * Output only. A number that monotonically increases every time the user
+     * modifies the desired state.
+     * 
+ * + * int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The generation. + */ + @java.lang.Override + public long getGeneration() { + return generation_; + } + /** + * + * + *
+     * Output only. A number that monotonically increases every time the user
+     * modifies the desired state.
+     * 
+ * + * int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The generation to set. + * @return This builder for chaining. + */ + public Builder setGeneration(long value) { + + generation_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. A number that monotonically increases every time the user
+     * modifies the desired state.
+     * 
+ * + * int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearGeneration() { + + generation_ = 0L; + onChanged(); + return this; + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + private com.google.protobuf.MapField + internalGetMutableLabels() { + onChanged(); + ; + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.lang.String getLabelsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearLabels() { + internalGetMutableLabels().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + public Builder removeLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableLabels().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableLabels() { + return internalGetMutableLabels().getMutableMap(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + public Builder putLabels(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableLabels().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + public Builder putAllLabels(java.util.Map values) { + internalGetMutableLabels().getMutableMap().putAll(values); + return this; + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + private com.google.protobuf.MapField + internalGetMutableAnnotations() { + onChanged(); + ; + if (annotations_ == null) { + annotations_ = + com.google.protobuf.MapField.newMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + if (!annotations_.isMutable()) { + annotations_ = annotations_.copy(); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+     * KRM-style annotations for the resource. Unstructured key value map that may
+     * be set by external tools to store and arbitrary metadata.
+     * They are not queryable and should be preserved
+     * when modifying objects. Cloud Run will populate some annotations using
+     * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+     * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+     * https://kubernetes.io/docs/user-guide/annotations
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+     * KRM-style annotations for the resource. Unstructured key value map that may
+     * be set by external tools to store and arbitrary metadata.
+     * They are not queryable and should be preserved
+     * when modifying objects. Cloud Run will populate some annotations using
+     * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+     * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+     * https://kubernetes.io/docs/user-guide/annotations
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+     * KRM-style annotations for the resource. Unstructured key value map that may
+     * be set by external tools to store and arbitrary metadata.
+     * They are not queryable and should be preserved
+     * when modifying objects. Cloud Run will populate some annotations using
+     * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+     * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+     * https://kubernetes.io/docs/user-guide/annotations
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * KRM-style annotations for the resource. Unstructured key value map that may
+     * be set by external tools to store and arbitrary metadata.
+     * They are not queryable and should be preserved
+     * when modifying objects. Cloud Run will populate some annotations using
+     * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+     * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+     * https://kubernetes.io/docs/user-guide/annotations
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearAnnotations() { + internalGetMutableAnnotations().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * KRM-style annotations for the resource. Unstructured key value map that may
+     * be set by external tools to store and arbitrary metadata.
+     * They are not queryable and should be preserved
+     * when modifying objects. Cloud Run will populate some annotations using
+     * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+     * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+     * https://kubernetes.io/docs/user-guide/annotations
+     * 
+ * + * map<string, string> annotations = 5; + */ + public Builder removeAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableAnnotations().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableAnnotations() { + return internalGetMutableAnnotations().getMutableMap(); + } + /** + * + * + *
+     * KRM-style annotations for the resource. Unstructured key value map that may
+     * be set by external tools to store and arbitrary metadata.
+     * They are not queryable and should be preserved
+     * when modifying objects. Cloud Run will populate some annotations using
+     * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+     * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+     * https://kubernetes.io/docs/user-guide/annotations
+     * 
+ * + * map<string, string> annotations = 5; + */ + public Builder putAnnotations(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableAnnotations().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * KRM-style annotations for the resource. Unstructured key value map that may
+     * be set by external tools to store and arbitrary metadata.
+     * They are not queryable and should be preserved
+     * when modifying objects. Cloud Run will populate some annotations using
+     * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+     * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+     * https://kubernetes.io/docs/user-guide/annotations
+     * 
+ * + * map<string, string> annotations = 5; + */ + public Builder putAllAnnotations(java.util.Map values) { + internalGetMutableAnnotations().getMutableMap().putAll(values); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private com.google.protobuf.Timestamp deleteTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + deleteTimeBuilder_; + /** + * + * + *
+     * Output only. The deletion time.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + public boolean hasDeleteTime() { + return deleteTimeBuilder_ != null || deleteTime_ != null; + } + /** + * + * + *
+     * Output only. The deletion time.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + public com.google.protobuf.Timestamp getDeleteTime() { + if (deleteTimeBuilder_ == null) { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } else { + return deleteTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The deletion time.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + deleteTime_ = value; + onChanged(); + } else { + deleteTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The deletion time.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (deleteTimeBuilder_ == null) { + deleteTime_ = builderForValue.build(); + onChanged(); + } else { + deleteTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The deletion time.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (deleteTime_ != null) { + deleteTime_ = + com.google.protobuf.Timestamp.newBuilder(deleteTime_).mergeFrom(value).buildPartial(); + } else { + deleteTime_ = value; + } + onChanged(); + } else { + deleteTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The deletion time.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearDeleteTime() { + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + onChanged(); + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The deletion time.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getDeleteTimeBuilder() { + + onChanged(); + return getDeleteTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The deletion time.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + if (deleteTimeBuilder_ != null) { + return deleteTimeBuilder_.getMessageOrBuilder(); + } else { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } + } + /** + * + * + *
+     * Output only. The deletion time.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getDeleteTimeFieldBuilder() { + if (deleteTimeBuilder_ == null) { + deleteTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getDeleteTime(), getParentForChildren(), isClean()); + deleteTime_ = null; + } + return deleteTimeBuilder_; + } + + private com.google.protobuf.Timestamp expireTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + expireTimeBuilder_; + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + public boolean hasExpireTime() { + return expireTimeBuilder_ != null || expireTime_ != null; + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + public com.google.protobuf.Timestamp getExpireTime() { + if (expireTimeBuilder_ == null) { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } else { + return expireTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + expireTime_ = value; + onChanged(); + } else { + expireTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setExpireTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (expireTimeBuilder_ == null) { + expireTime_ = builderForValue.build(); + onChanged(); + } else { + expireTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (expireTime_ != null) { + expireTime_ = + com.google.protobuf.Timestamp.newBuilder(expireTime_).mergeFrom(value).buildPartial(); + } else { + expireTime_ = value; + } + onChanged(); + } else { + expireTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearExpireTime() { + if (expireTimeBuilder_ == null) { + expireTime_ = null; + onChanged(); + } else { + expireTime_ = null; + expireTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getExpireTimeBuilder() { + + onChanged(); + return getExpireTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + if (expireTimeBuilder_ != null) { + return expireTimeBuilder_.getMessageOrBuilder(); + } else { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getExpireTimeFieldBuilder() { + if (expireTimeBuilder_ == null) { + expireTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getExpireTime(), getParentForChildren(), isClean()); + expireTime_ = null; + } + return expireTimeBuilder_; + } + + private java.lang.Object creator_ = ""; + /** + * + * + *
+     * Output only. Email address of the authenticated creator.
+     * 
+ * + * string creator = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The creator. + */ + public java.lang.String getCreator() { + java.lang.Object ref = creator_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + creator_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Email address of the authenticated creator.
+     * 
+ * + * string creator = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for creator. + */ + public com.google.protobuf.ByteString getCreatorBytes() { + java.lang.Object ref = creator_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + creator_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Email address of the authenticated creator.
+     * 
+ * + * string creator = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The creator to set. + * @return This builder for chaining. + */ + public Builder setCreator(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + creator_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Email address of the authenticated creator.
+     * 
+ * + * string creator = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearCreator() { + + creator_ = getDefaultInstance().getCreator(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Email address of the authenticated creator.
+     * 
+ * + * string creator = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for creator to set. + * @return This builder for chaining. + */ + public Builder setCreatorBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + creator_ = value; + onChanged(); + return this; + } + + private java.lang.Object lastModifier_ = ""; + /** + * + * + *
+     * Output only. Email address of the last authenticated modifier.
+     * 
+ * + * string last_modifier = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The lastModifier. + */ + public java.lang.String getLastModifier() { + java.lang.Object ref = lastModifier_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + lastModifier_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Email address of the last authenticated modifier.
+     * 
+ * + * string last_modifier = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for lastModifier. + */ + public com.google.protobuf.ByteString getLastModifierBytes() { + java.lang.Object ref = lastModifier_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + lastModifier_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Email address of the last authenticated modifier.
+     * 
+ * + * string last_modifier = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The lastModifier to set. + * @return This builder for chaining. + */ + public Builder setLastModifier(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + lastModifier_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Email address of the last authenticated modifier.
+     * 
+ * + * string last_modifier = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearLastModifier() { + + lastModifier_ = getDefaultInstance().getLastModifier(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Email address of the last authenticated modifier.
+     * 
+ * + * string last_modifier = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for lastModifier to set. + * @return This builder for chaining. + */ + public Builder setLastModifierBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + lastModifier_ = value; + onChanged(); + return this; + } + + private java.lang.Object client_ = ""; + /** + * + * + *
+     * Arbitrary identifier for the API client.
+     * 
+ * + * string client = 12; + * + * @return The client. + */ + public java.lang.String getClient() { + java.lang.Object ref = client_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + client_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Arbitrary identifier for the API client.
+     * 
+ * + * string client = 12; + * + * @return The bytes for client. + */ + public com.google.protobuf.ByteString getClientBytes() { + java.lang.Object ref = client_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + client_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Arbitrary identifier for the API client.
+     * 
+ * + * string client = 12; + * + * @param value The client to set. + * @return This builder for chaining. + */ + public Builder setClient(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + client_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Arbitrary identifier for the API client.
+     * 
+ * + * string client = 12; + * + * @return This builder for chaining. + */ + public Builder clearClient() { + + client_ = getDefaultInstance().getClient(); + onChanged(); + return this; + } + /** + * + * + *
+     * Arbitrary identifier for the API client.
+     * 
+ * + * string client = 12; + * + * @param value The bytes for client to set. + * @return This builder for chaining. + */ + public Builder setClientBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + client_ = value; + onChanged(); + return this; + } + + private java.lang.Object clientVersion_ = ""; + /** + * + * + *
+     * Arbitrary version identifier for the API client.
+     * 
+ * + * string client_version = 13; + * + * @return The clientVersion. + */ + public java.lang.String getClientVersion() { + java.lang.Object ref = clientVersion_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + clientVersion_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Arbitrary version identifier for the API client.
+     * 
+ * + * string client_version = 13; + * + * @return The bytes for clientVersion. + */ + public com.google.protobuf.ByteString getClientVersionBytes() { + java.lang.Object ref = clientVersion_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + clientVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Arbitrary version identifier for the API client.
+     * 
+ * + * string client_version = 13; + * + * @param value The clientVersion to set. + * @return This builder for chaining. + */ + public Builder setClientVersion(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + clientVersion_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Arbitrary version identifier for the API client.
+     * 
+ * + * string client_version = 13; + * + * @return This builder for chaining. + */ + public Builder clearClientVersion() { + + clientVersion_ = getDefaultInstance().getClientVersion(); + onChanged(); + return this; + } + /** + * + * + *
+     * Arbitrary version identifier for the API client.
+     * 
+ * + * string client_version = 13; + * + * @param value The bytes for clientVersion to set. + * @return This builder for chaining. + */ + public Builder setClientVersionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + clientVersion_ = value; + onChanged(); + return this; + } + + private int launchStage_ = 0; + /** + * + * + *
+     * The launch stage as defined by [Google Cloud Platform
+     * Launch Stages](https://cloud.google.com/terms/launch-stages).
+     * Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
+     * is assumed.
+     * 
+ * + * .google.api.LaunchStage launch_stage = 14; + * + * @return The enum numeric value on the wire for launchStage. + */ + @java.lang.Override + public int getLaunchStageValue() { + return launchStage_; + } + /** + * + * + *
+     * The launch stage as defined by [Google Cloud Platform
+     * Launch Stages](https://cloud.google.com/terms/launch-stages).
+     * Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
+     * is assumed.
+     * 
+ * + * .google.api.LaunchStage launch_stage = 14; + * + * @param value The enum numeric value on the wire for launchStage to set. + * @return This builder for chaining. + */ + public Builder setLaunchStageValue(int value) { + + launchStage_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The launch stage as defined by [Google Cloud Platform
+     * Launch Stages](https://cloud.google.com/terms/launch-stages).
+     * Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
+     * is assumed.
+     * 
+ * + * .google.api.LaunchStage launch_stage = 14; + * + * @return The launchStage. + */ + @java.lang.Override + public com.google.api.LaunchStage getLaunchStage() { + @SuppressWarnings("deprecation") + com.google.api.LaunchStage result = com.google.api.LaunchStage.valueOf(launchStage_); + return result == null ? com.google.api.LaunchStage.UNRECOGNIZED : result; + } + /** + * + * + *
+     * The launch stage as defined by [Google Cloud Platform
+     * Launch Stages](https://cloud.google.com/terms/launch-stages).
+     * Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
+     * is assumed.
+     * 
+ * + * .google.api.LaunchStage launch_stage = 14; + * + * @param value The launchStage to set. + * @return This builder for chaining. + */ + public Builder setLaunchStage(com.google.api.LaunchStage value) { + if (value == null) { + throw new NullPointerException(); + } + + launchStage_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The launch stage as defined by [Google Cloud Platform
+     * Launch Stages](https://cloud.google.com/terms/launch-stages).
+     * Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
+     * is assumed.
+     * 
+ * + * .google.api.LaunchStage launch_stage = 14; + * + * @return This builder for chaining. + */ + public Builder clearLaunchStage() { + + launchStage_ = 0; + onChanged(); + return this; + } + + private com.google.cloud.run.v2.BinaryAuthorization binaryAuthorization_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.BinaryAuthorization, + com.google.cloud.run.v2.BinaryAuthorization.Builder, + com.google.cloud.run.v2.BinaryAuthorizationOrBuilder> + binaryAuthorizationBuilder_; + /** + * + * + *
+     * Settings for the Binary Authorization feature.
+     * 
+ * + * .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + * + * @return Whether the binaryAuthorization field is set. + */ + public boolean hasBinaryAuthorization() { + return binaryAuthorizationBuilder_ != null || binaryAuthorization_ != null; + } + /** + * + * + *
+     * Settings for the Binary Authorization feature.
+     * 
+ * + * .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + * + * @return The binaryAuthorization. + */ + public com.google.cloud.run.v2.BinaryAuthorization getBinaryAuthorization() { + if (binaryAuthorizationBuilder_ == null) { + return binaryAuthorization_ == null + ? com.google.cloud.run.v2.BinaryAuthorization.getDefaultInstance() + : binaryAuthorization_; + } else { + return binaryAuthorizationBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Settings for the Binary Authorization feature.
+     * 
+ * + * .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + */ + public Builder setBinaryAuthorization(com.google.cloud.run.v2.BinaryAuthorization value) { + if (binaryAuthorizationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + binaryAuthorization_ = value; + onChanged(); + } else { + binaryAuthorizationBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Settings for the Binary Authorization feature.
+     * 
+ * + * .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + */ + public Builder setBinaryAuthorization( + com.google.cloud.run.v2.BinaryAuthorization.Builder builderForValue) { + if (binaryAuthorizationBuilder_ == null) { + binaryAuthorization_ = builderForValue.build(); + onChanged(); + } else { + binaryAuthorizationBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Settings for the Binary Authorization feature.
+     * 
+ * + * .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + */ + public Builder mergeBinaryAuthorization(com.google.cloud.run.v2.BinaryAuthorization value) { + if (binaryAuthorizationBuilder_ == null) { + if (binaryAuthorization_ != null) { + binaryAuthorization_ = + com.google.cloud.run.v2.BinaryAuthorization.newBuilder(binaryAuthorization_) + .mergeFrom(value) + .buildPartial(); + } else { + binaryAuthorization_ = value; + } + onChanged(); + } else { + binaryAuthorizationBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Settings for the Binary Authorization feature.
+     * 
+ * + * .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + */ + public Builder clearBinaryAuthorization() { + if (binaryAuthorizationBuilder_ == null) { + binaryAuthorization_ = null; + onChanged(); + } else { + binaryAuthorization_ = null; + binaryAuthorizationBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Settings for the Binary Authorization feature.
+     * 
+ * + * .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + */ + public com.google.cloud.run.v2.BinaryAuthorization.Builder getBinaryAuthorizationBuilder() { + + onChanged(); + return getBinaryAuthorizationFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Settings for the Binary Authorization feature.
+     * 
+ * + * .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + */ + public com.google.cloud.run.v2.BinaryAuthorizationOrBuilder getBinaryAuthorizationOrBuilder() { + if (binaryAuthorizationBuilder_ != null) { + return binaryAuthorizationBuilder_.getMessageOrBuilder(); + } else { + return binaryAuthorization_ == null + ? com.google.cloud.run.v2.BinaryAuthorization.getDefaultInstance() + : binaryAuthorization_; + } + } + /** + * + * + *
+     * Settings for the Binary Authorization feature.
+     * 
+ * + * .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.BinaryAuthorization, + com.google.cloud.run.v2.BinaryAuthorization.Builder, + com.google.cloud.run.v2.BinaryAuthorizationOrBuilder> + getBinaryAuthorizationFieldBuilder() { + if (binaryAuthorizationBuilder_ == null) { + binaryAuthorizationBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.BinaryAuthorization, + com.google.cloud.run.v2.BinaryAuthorization.Builder, + com.google.cloud.run.v2.BinaryAuthorizationOrBuilder>( + getBinaryAuthorization(), getParentForChildren(), isClean()); + binaryAuthorization_ = null; + } + return binaryAuthorizationBuilder_; + } + + private com.google.cloud.run.v2.ExecutionTemplate template_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.ExecutionTemplate, + com.google.cloud.run.v2.ExecutionTemplate.Builder, + com.google.cloud.run.v2.ExecutionTemplateOrBuilder> + templateBuilder_; + /** + * + * + *
+     * Required. The template used to create executions for this Job.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the template field is set. + */ + public boolean hasTemplate() { + return templateBuilder_ != null || template_ != null; + } + /** + * + * + *
+     * Required. The template used to create executions for this Job.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The template. + */ + public com.google.cloud.run.v2.ExecutionTemplate getTemplate() { + if (templateBuilder_ == null) { + return template_ == null + ? com.google.cloud.run.v2.ExecutionTemplate.getDefaultInstance() + : template_; + } else { + return templateBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The template used to create executions for this Job.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setTemplate(com.google.cloud.run.v2.ExecutionTemplate value) { + if (templateBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + template_ = value; + onChanged(); + } else { + templateBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The template used to create executions for this Job.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setTemplate(com.google.cloud.run.v2.ExecutionTemplate.Builder builderForValue) { + if (templateBuilder_ == null) { + template_ = builderForValue.build(); + onChanged(); + } else { + templateBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The template used to create executions for this Job.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeTemplate(com.google.cloud.run.v2.ExecutionTemplate value) { + if (templateBuilder_ == null) { + if (template_ != null) { + template_ = + com.google.cloud.run.v2.ExecutionTemplate.newBuilder(template_) + .mergeFrom(value) + .buildPartial(); + } else { + template_ = value; + } + onChanged(); + } else { + templateBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The template used to create executions for this Job.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearTemplate() { + if (templateBuilder_ == null) { + template_ = null; + onChanged(); + } else { + template_ = null; + templateBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The template used to create executions for this Job.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.run.v2.ExecutionTemplate.Builder getTemplateBuilder() { + + onChanged(); + return getTemplateFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The template used to create executions for this Job.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.run.v2.ExecutionTemplateOrBuilder getTemplateOrBuilder() { + if (templateBuilder_ != null) { + return templateBuilder_.getMessageOrBuilder(); + } else { + return template_ == null + ? com.google.cloud.run.v2.ExecutionTemplate.getDefaultInstance() + : template_; + } + } + /** + * + * + *
+     * Required. The template used to create executions for this Job.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.ExecutionTemplate, + com.google.cloud.run.v2.ExecutionTemplate.Builder, + com.google.cloud.run.v2.ExecutionTemplateOrBuilder> + getTemplateFieldBuilder() { + if (templateBuilder_ == null) { + templateBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.ExecutionTemplate, + com.google.cloud.run.v2.ExecutionTemplate.Builder, + com.google.cloud.run.v2.ExecutionTemplateOrBuilder>( + getTemplate(), getParentForChildren(), isClean()); + template_ = null; + } + return templateBuilder_; + } + + private long observedGeneration_; + /** + * + * + *
+     * Output only. The generation of this Job. See comments in `reconciling` for additional
+     * information on reconciliation process in Cloud Run.
+     * 
+ * + * int64 observed_generation = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The observedGeneration. + */ + @java.lang.Override + public long getObservedGeneration() { + return observedGeneration_; + } + /** + * + * + *
+     * Output only. The generation of this Job. See comments in `reconciling` for additional
+     * information on reconciliation process in Cloud Run.
+     * 
+ * + * int64 observed_generation = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The observedGeneration to set. + * @return This builder for chaining. + */ + public Builder setObservedGeneration(long value) { + + observedGeneration_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The generation of this Job. See comments in `reconciling` for additional
+     * information on reconciliation process in Cloud Run.
+     * 
+ * + * int64 observed_generation = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearObservedGeneration() { + + observedGeneration_ = 0L; + onChanged(); + return this; + } + + private com.google.cloud.run.v2.Condition terminalCondition_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.Condition, + com.google.cloud.run.v2.Condition.Builder, + com.google.cloud.run.v2.ConditionOrBuilder> + terminalConditionBuilder_; + /** + * + * + *
+     * Output only. The Condition of this Job, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the terminalCondition field is set. + */ + public boolean hasTerminalCondition() { + return terminalConditionBuilder_ != null || terminalCondition_ != null; + } + /** + * + * + *
+     * Output only. The Condition of this Job, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The terminalCondition. + */ + public com.google.cloud.run.v2.Condition getTerminalCondition() { + if (terminalConditionBuilder_ == null) { + return terminalCondition_ == null + ? com.google.cloud.run.v2.Condition.getDefaultInstance() + : terminalCondition_; + } else { + return terminalConditionBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The Condition of this Job, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setTerminalCondition(com.google.cloud.run.v2.Condition value) { + if (terminalConditionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + terminalCondition_ = value; + onChanged(); + } else { + terminalConditionBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Job, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setTerminalCondition(com.google.cloud.run.v2.Condition.Builder builderForValue) { + if (terminalConditionBuilder_ == null) { + terminalCondition_ = builderForValue.build(); + onChanged(); + } else { + terminalConditionBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Job, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeTerminalCondition(com.google.cloud.run.v2.Condition value) { + if (terminalConditionBuilder_ == null) { + if (terminalCondition_ != null) { + terminalCondition_ = + com.google.cloud.run.v2.Condition.newBuilder(terminalCondition_) + .mergeFrom(value) + .buildPartial(); + } else { + terminalCondition_ = value; + } + onChanged(); + } else { + terminalConditionBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Job, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearTerminalCondition() { + if (terminalConditionBuilder_ == null) { + terminalCondition_ = null; + onChanged(); + } else { + terminalCondition_ = null; + terminalConditionBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Job, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.Condition.Builder getTerminalConditionBuilder() { + + onChanged(); + return getTerminalConditionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The Condition of this Job, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.ConditionOrBuilder getTerminalConditionOrBuilder() { + if (terminalConditionBuilder_ != null) { + return terminalConditionBuilder_.getMessageOrBuilder(); + } else { + return terminalCondition_ == null + ? com.google.cloud.run.v2.Condition.getDefaultInstance() + : terminalCondition_; + } + } + /** + * + * + *
+     * Output only. The Condition of this Job, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.Condition, + com.google.cloud.run.v2.Condition.Builder, + com.google.cloud.run.v2.ConditionOrBuilder> + getTerminalConditionFieldBuilder() { + if (terminalConditionBuilder_ == null) { + terminalConditionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.Condition, + com.google.cloud.run.v2.Condition.Builder, + com.google.cloud.run.v2.ConditionOrBuilder>( + getTerminalCondition(), getParentForChildren(), isClean()); + terminalCondition_ = null; + } + return terminalConditionBuilder_; + } + + private java.util.List conditions_ = + java.util.Collections.emptyList(); + + private void ensureConditionsIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + conditions_ = new java.util.ArrayList(conditions_); + bitField0_ |= 0x00000004; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Condition, + com.google.cloud.run.v2.Condition.Builder, + com.google.cloud.run.v2.ConditionOrBuilder> + conditionsBuilder_; + + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List getConditionsList() { + if (conditionsBuilder_ == null) { + return java.util.Collections.unmodifiableList(conditions_); + } else { + return conditionsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public int getConditionsCount() { + if (conditionsBuilder_ == null) { + return conditions_.size(); + } else { + return conditionsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.Condition getConditions(int index) { + if (conditionsBuilder_ == null) { + return conditions_.get(index); + } else { + return conditionsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setConditions(int index, com.google.cloud.run.v2.Condition value) { + if (conditionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureConditionsIsMutable(); + conditions_.set(index, value); + onChanged(); + } else { + conditionsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setConditions( + int index, com.google.cloud.run.v2.Condition.Builder builderForValue) { + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + conditions_.set(index, builderForValue.build()); + onChanged(); + } else { + conditionsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addConditions(com.google.cloud.run.v2.Condition value) { + if (conditionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureConditionsIsMutable(); + conditions_.add(value); + onChanged(); + } else { + conditionsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addConditions(int index, com.google.cloud.run.v2.Condition value) { + if (conditionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureConditionsIsMutable(); + conditions_.add(index, value); + onChanged(); + } else { + conditionsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addConditions(com.google.cloud.run.v2.Condition.Builder builderForValue) { + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + conditions_.add(builderForValue.build()); + onChanged(); + } else { + conditionsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addConditions( + int index, com.google.cloud.run.v2.Condition.Builder builderForValue) { + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + conditions_.add(index, builderForValue.build()); + onChanged(); + } else { + conditionsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addAllConditions( + java.lang.Iterable values) { + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, conditions_); + onChanged(); + } else { + conditionsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearConditions() { + if (conditionsBuilder_ == null) { + conditions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + } else { + conditionsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder removeConditions(int index) { + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + conditions_.remove(index); + onChanged(); + } else { + conditionsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.Condition.Builder getConditionsBuilder(int index) { + return getConditionsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.ConditionOrBuilder getConditionsOrBuilder(int index) { + if (conditionsBuilder_ == null) { + return conditions_.get(index); + } else { + return conditionsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List + getConditionsOrBuilderList() { + if (conditionsBuilder_ != null) { + return conditionsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(conditions_); + } + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.Condition.Builder addConditionsBuilder() { + return getConditionsFieldBuilder() + .addBuilder(com.google.cloud.run.v2.Condition.getDefaultInstance()); + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.Condition.Builder addConditionsBuilder(int index) { + return getConditionsFieldBuilder() + .addBuilder(index, com.google.cloud.run.v2.Condition.getDefaultInstance()); + } + /** + * + * + *
+     * Output only. The Conditions of all other associated sub-resources. They contain
+     * additional diagnostics information in case the Job does not reach its
+     * desired state. See comments in `reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List getConditionsBuilderList() { + return getConditionsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Condition, + com.google.cloud.run.v2.Condition.Builder, + com.google.cloud.run.v2.ConditionOrBuilder> + getConditionsFieldBuilder() { + if (conditionsBuilder_ == null) { + conditionsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Condition, + com.google.cloud.run.v2.Condition.Builder, + com.google.cloud.run.v2.ConditionOrBuilder>( + conditions_, ((bitField0_ & 0x00000004) != 0), getParentForChildren(), isClean()); + conditions_ = null; + } + return conditionsBuilder_; + } + + private int executionCount_; + /** + * + * + *
+     * Output only. Number of executions created for this job.
+     * 
+ * + * int32 execution_count = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The executionCount. + */ + @java.lang.Override + public int getExecutionCount() { + return executionCount_; + } + /** + * + * + *
+     * Output only. Number of executions created for this job.
+     * 
+ * + * int32 execution_count = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The executionCount to set. + * @return This builder for chaining. + */ + public Builder setExecutionCount(int value) { + + executionCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Number of executions created for this job.
+     * 
+ * + * int32 execution_count = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearExecutionCount() { + + executionCount_ = 0; + onChanged(); + return this; + } + + private com.google.cloud.run.v2.ExecutionReference latestCreatedExecution_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.ExecutionReference, + com.google.cloud.run.v2.ExecutionReference.Builder, + com.google.cloud.run.v2.ExecutionReferenceOrBuilder> + latestCreatedExecutionBuilder_; + /** + * + * + *
+     * Output only. Name of the last created execution.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the latestCreatedExecution field is set. + */ + public boolean hasLatestCreatedExecution() { + return latestCreatedExecutionBuilder_ != null || latestCreatedExecution_ != null; + } + /** + * + * + *
+     * Output only. Name of the last created execution.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The latestCreatedExecution. + */ + public com.google.cloud.run.v2.ExecutionReference getLatestCreatedExecution() { + if (latestCreatedExecutionBuilder_ == null) { + return latestCreatedExecution_ == null + ? com.google.cloud.run.v2.ExecutionReference.getDefaultInstance() + : latestCreatedExecution_; + } else { + return latestCreatedExecutionBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Name of the last created execution.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setLatestCreatedExecution(com.google.cloud.run.v2.ExecutionReference value) { + if (latestCreatedExecutionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + latestCreatedExecution_ = value; + onChanged(); + } else { + latestCreatedExecutionBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Name of the last created execution.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setLatestCreatedExecution( + com.google.cloud.run.v2.ExecutionReference.Builder builderForValue) { + if (latestCreatedExecutionBuilder_ == null) { + latestCreatedExecution_ = builderForValue.build(); + onChanged(); + } else { + latestCreatedExecutionBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. Name of the last created execution.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeLatestCreatedExecution(com.google.cloud.run.v2.ExecutionReference value) { + if (latestCreatedExecutionBuilder_ == null) { + if (latestCreatedExecution_ != null) { + latestCreatedExecution_ = + com.google.cloud.run.v2.ExecutionReference.newBuilder(latestCreatedExecution_) + .mergeFrom(value) + .buildPartial(); + } else { + latestCreatedExecution_ = value; + } + onChanged(); + } else { + latestCreatedExecutionBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Name of the last created execution.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearLatestCreatedExecution() { + if (latestCreatedExecutionBuilder_ == null) { + latestCreatedExecution_ = null; + onChanged(); + } else { + latestCreatedExecution_ = null; + latestCreatedExecutionBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. Name of the last created execution.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.ExecutionReference.Builder getLatestCreatedExecutionBuilder() { + + onChanged(); + return getLatestCreatedExecutionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Name of the last created execution.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.ExecutionReferenceOrBuilder + getLatestCreatedExecutionOrBuilder() { + if (latestCreatedExecutionBuilder_ != null) { + return latestCreatedExecutionBuilder_.getMessageOrBuilder(); + } else { + return latestCreatedExecution_ == null + ? com.google.cloud.run.v2.ExecutionReference.getDefaultInstance() + : latestCreatedExecution_; + } + } + /** + * + * + *
+     * Output only. Name of the last created execution.
+     * 
+ * + * + * .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.ExecutionReference, + com.google.cloud.run.v2.ExecutionReference.Builder, + com.google.cloud.run.v2.ExecutionReferenceOrBuilder> + getLatestCreatedExecutionFieldBuilder() { + if (latestCreatedExecutionBuilder_ == null) { + latestCreatedExecutionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.ExecutionReference, + com.google.cloud.run.v2.ExecutionReference.Builder, + com.google.cloud.run.v2.ExecutionReferenceOrBuilder>( + getLatestCreatedExecution(), getParentForChildren(), isClean()); + latestCreatedExecution_ = null; + } + return latestCreatedExecutionBuilder_; + } + + private boolean reconciling_; + /** + * + * + *
+     * Output only. Returns true if the Job is currently being acted upon by the system to
+     * bring it into the desired state.
+     * When a new Job is created, or an existing one is updated, Cloud Run
+     * will asynchronously perform all necessary steps to bring the Job to the
+     * desired state. This process is called reconciliation.
+     * While reconciliation is in process, `observed_generation` and
+     * `latest_succeeded_execution`, will have transient values that might
+     * mismatch the intended state: Once reconciliation is over (and this field is
+     * false), there are two possible outcomes: reconciliation succeeded and the
+     * state matches the Job, or there was an error,  and reconciliation failed.
+     * This state can be found in `terminal_condition.state`.
+     * If reconciliation succeeded, the following fields will match:
+     * `observed_generation` and `generation`, `latest_succeeded_execution` and
+     * `latest_created_execution`.
+     * If reconciliation failed, `observed_generation` and
+     * `latest_succeeded_execution` will have the state of the last succeeded
+     * execution or empty for newly created Job. Additional information on the
+     * failure can be found in `terminal_condition` and `conditions`.
+     * 
+ * + * bool reconciling = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + @java.lang.Override + public boolean getReconciling() { + return reconciling_; + } + /** + * + * + *
+     * Output only. Returns true if the Job is currently being acted upon by the system to
+     * bring it into the desired state.
+     * When a new Job is created, or an existing one is updated, Cloud Run
+     * will asynchronously perform all necessary steps to bring the Job to the
+     * desired state. This process is called reconciliation.
+     * While reconciliation is in process, `observed_generation` and
+     * `latest_succeeded_execution`, will have transient values that might
+     * mismatch the intended state: Once reconciliation is over (and this field is
+     * false), there are two possible outcomes: reconciliation succeeded and the
+     * state matches the Job, or there was an error,  and reconciliation failed.
+     * This state can be found in `terminal_condition.state`.
+     * If reconciliation succeeded, the following fields will match:
+     * `observed_generation` and `generation`, `latest_succeeded_execution` and
+     * `latest_created_execution`.
+     * If reconciliation failed, `observed_generation` and
+     * `latest_succeeded_execution` will have the state of the last succeeded
+     * execution or empty for newly created Job. Additional information on the
+     * failure can be found in `terminal_condition` and `conditions`.
+     * 
+ * + * bool reconciling = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The reconciling to set. + * @return This builder for chaining. + */ + public Builder setReconciling(boolean value) { + + reconciling_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Returns true if the Job is currently being acted upon by the system to
+     * bring it into the desired state.
+     * When a new Job is created, or an existing one is updated, Cloud Run
+     * will asynchronously perform all necessary steps to bring the Job to the
+     * desired state. This process is called reconciliation.
+     * While reconciliation is in process, `observed_generation` and
+     * `latest_succeeded_execution`, will have transient values that might
+     * mismatch the intended state: Once reconciliation is over (and this field is
+     * false), there are two possible outcomes: reconciliation succeeded and the
+     * state matches the Job, or there was an error,  and reconciliation failed.
+     * This state can be found in `terminal_condition.state`.
+     * If reconciliation succeeded, the following fields will match:
+     * `observed_generation` and `generation`, `latest_succeeded_execution` and
+     * `latest_created_execution`.
+     * If reconciliation failed, `observed_generation` and
+     * `latest_succeeded_execution` will have the state of the last succeeded
+     * execution or empty for newly created Job. Additional information on the
+     * failure can be found in `terminal_condition` and `conditions`.
+     * 
+ * + * bool reconciling = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearReconciling() { + + reconciling_ = false; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * Output only. A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.Job) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.Job) + private static final com.google.cloud.run.v2.Job DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.Job(); + } + + public static com.google.cloud.run.v2.Job getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Job parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.Job getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobName.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobName.java new file mode 100644 index 000000000000..baf8dde256dd --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobName.java @@ -0,0 +1,216 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class JobName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_JOB = + PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}/jobs/{job}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String job; + + @Deprecated + protected JobName() { + project = null; + location = null; + job = null; + } + + private JobName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + job = Preconditions.checkNotNull(builder.getJob()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getJob() { + return job; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static JobName of(String project, String location, String job) { + return newBuilder().setProject(project).setLocation(location).setJob(job).build(); + } + + public static String format(String project, String location, String job) { + return newBuilder().setProject(project).setLocation(location).setJob(job).build().toString(); + } + + public static JobName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_JOB.validatedMatch( + formattedString, "JobName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("job")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (JobName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_JOB.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (job != null) { + fieldMapBuilder.put("job", job); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_JOB.instantiate("project", project, "location", location, "job", job); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + JobName that = ((JobName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.job, that.job); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(job); + return h; + } + + /** Builder for projects/{project}/locations/{location}/jobs/{job}. */ + public static class Builder { + private String project; + private String location; + private String job; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getJob() { + return job; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setJob(String job) { + this.job = job; + return this; + } + + private Builder(JobName jobName) { + this.project = jobName.project; + this.location = jobName.location; + this.job = jobName.job; + } + + public JobName build() { + return new JobName(this); + } + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobOrBuilder.java new file mode 100644 index 000000000000..64c976a746ae --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobOrBuilder.java @@ -0,0 +1,890 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +public interface JobOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.Job) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The fully qualified name of this Job.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * The fully qualified name of this Job.
+   * Format:
+   * projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Output only. Server assigned unique identifier for the Execution. The value is a UUID4
+   * string and guaranteed to remain unchanged until the resource is deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + java.lang.String getUid(); + /** + * + * + *
+   * Output only. Server assigned unique identifier for the Execution. The value is a UUID4
+   * string and guaranteed to remain unchanged until the resource is deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + com.google.protobuf.ByteString getUidBytes(); + + /** + * + * + *
+   * Output only. A number that monotonically increases every time the user
+   * modifies the desired state.
+   * 
+ * + * int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The generation. + */ + long getGeneration(); + + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + int getLabelsCount(); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getLabels(); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + java.util.Map getLabelsMap(); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + + /* nullable */ + java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + java.lang.String getLabelsOrThrow(java.lang.String key); + + /** + * + * + *
+   * KRM-style annotations for the resource. Unstructured key value map that may
+   * be set by external tools to store and arbitrary metadata.
+   * They are not queryable and should be preserved
+   * when modifying objects. Cloud Run will populate some annotations using
+   * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+   * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+   * https://kubernetes.io/docs/user-guide/annotations
+   * 
+ * + * map<string, string> annotations = 5; + */ + int getAnnotationsCount(); + /** + * + * + *
+   * KRM-style annotations for the resource. Unstructured key value map that may
+   * be set by external tools to store and arbitrary metadata.
+   * They are not queryable and should be preserved
+   * when modifying objects. Cloud Run will populate some annotations using
+   * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+   * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+   * https://kubernetes.io/docs/user-guide/annotations
+   * 
+ * + * map<string, string> annotations = 5; + */ + boolean containsAnnotations(java.lang.String key); + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getAnnotations(); + /** + * + * + *
+   * KRM-style annotations for the resource. Unstructured key value map that may
+   * be set by external tools to store and arbitrary metadata.
+   * They are not queryable and should be preserved
+   * when modifying objects. Cloud Run will populate some annotations using
+   * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+   * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+   * https://kubernetes.io/docs/user-guide/annotations
+   * 
+ * + * map<string, string> annotations = 5; + */ + java.util.Map getAnnotationsMap(); + /** + * + * + *
+   * KRM-style annotations for the resource. Unstructured key value map that may
+   * be set by external tools to store and arbitrary metadata.
+   * They are not queryable and should be preserved
+   * when modifying objects. Cloud Run will populate some annotations using
+   * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+   * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+   * https://kubernetes.io/docs/user-guide/annotations
+   * 
+ * + * map<string, string> annotations = 5; + */ + + /* nullable */ + java.lang.String getAnnotationsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * KRM-style annotations for the resource. Unstructured key value map that may
+   * be set by external tools to store and arbitrary metadata.
+   * They are not queryable and should be preserved
+   * when modifying objects. Cloud Run will populate some annotations using
+   * 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field
+   * follows Kubernetes annotations' namespacing, limits, and rules. More info:
+   * https://kubernetes.io/docs/user-guide/annotations
+   * 
+ * + * map<string, string> annotations = 5; + */ + java.lang.String getAnnotationsOrThrow(java.lang.String key); + + /** + * + * + *
+   * Output only. The creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Output only. The creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Output only. The creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The deletion time.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + boolean hasDeleteTime(); + /** + * + * + *
+   * Output only. The deletion time.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + com.google.protobuf.Timestamp getDeleteTime(); + /** + * + * + *
+   * Output only. The deletion time.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder(); + + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + boolean hasExpireTime(); + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + com.google.protobuf.Timestamp getExpireTime(); + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder(); + + /** + * + * + *
+   * Output only. Email address of the authenticated creator.
+   * 
+ * + * string creator = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The creator. + */ + java.lang.String getCreator(); + /** + * + * + *
+   * Output only. Email address of the authenticated creator.
+   * 
+ * + * string creator = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for creator. + */ + com.google.protobuf.ByteString getCreatorBytes(); + + /** + * + * + *
+   * Output only. Email address of the last authenticated modifier.
+   * 
+ * + * string last_modifier = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The lastModifier. + */ + java.lang.String getLastModifier(); + /** + * + * + *
+   * Output only. Email address of the last authenticated modifier.
+   * 
+ * + * string last_modifier = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for lastModifier. + */ + com.google.protobuf.ByteString getLastModifierBytes(); + + /** + * + * + *
+   * Arbitrary identifier for the API client.
+   * 
+ * + * string client = 12; + * + * @return The client. + */ + java.lang.String getClient(); + /** + * + * + *
+   * Arbitrary identifier for the API client.
+   * 
+ * + * string client = 12; + * + * @return The bytes for client. + */ + com.google.protobuf.ByteString getClientBytes(); + + /** + * + * + *
+   * Arbitrary version identifier for the API client.
+   * 
+ * + * string client_version = 13; + * + * @return The clientVersion. + */ + java.lang.String getClientVersion(); + /** + * + * + *
+   * Arbitrary version identifier for the API client.
+   * 
+ * + * string client_version = 13; + * + * @return The bytes for clientVersion. + */ + com.google.protobuf.ByteString getClientVersionBytes(); + + /** + * + * + *
+   * The launch stage as defined by [Google Cloud Platform
+   * Launch Stages](https://cloud.google.com/terms/launch-stages).
+   * Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
+   * is assumed.
+   * 
+ * + * .google.api.LaunchStage launch_stage = 14; + * + * @return The enum numeric value on the wire for launchStage. + */ + int getLaunchStageValue(); + /** + * + * + *
+   * The launch stage as defined by [Google Cloud Platform
+   * Launch Stages](https://cloud.google.com/terms/launch-stages).
+   * Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA
+   * is assumed.
+   * 
+ * + * .google.api.LaunchStage launch_stage = 14; + * + * @return The launchStage. + */ + com.google.api.LaunchStage getLaunchStage(); + + /** + * + * + *
+   * Settings for the Binary Authorization feature.
+   * 
+ * + * .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + * + * @return Whether the binaryAuthorization field is set. + */ + boolean hasBinaryAuthorization(); + /** + * + * + *
+   * Settings for the Binary Authorization feature.
+   * 
+ * + * .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + * + * @return The binaryAuthorization. + */ + com.google.cloud.run.v2.BinaryAuthorization getBinaryAuthorization(); + /** + * + * + *
+   * Settings for the Binary Authorization feature.
+   * 
+ * + * .google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + */ + com.google.cloud.run.v2.BinaryAuthorizationOrBuilder getBinaryAuthorizationOrBuilder(); + + /** + * + * + *
+   * Required. The template used to create executions for this Job.
+   * 
+ * + * + * .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the template field is set. + */ + boolean hasTemplate(); + /** + * + * + *
+   * Required. The template used to create executions for this Job.
+   * 
+ * + * + * .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The template. + */ + com.google.cloud.run.v2.ExecutionTemplate getTemplate(); + /** + * + * + *
+   * Required. The template used to create executions for this Job.
+   * 
+ * + * + * .google.cloud.run.v2.ExecutionTemplate template = 16 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.run.v2.ExecutionTemplateOrBuilder getTemplateOrBuilder(); + + /** + * + * + *
+   * Output only. The generation of this Job. See comments in `reconciling` for additional
+   * information on reconciliation process in Cloud Run.
+   * 
+ * + * int64 observed_generation = 17 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The observedGeneration. + */ + long getObservedGeneration(); + + /** + * + * + *
+   * Output only. The Condition of this Job, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the terminalCondition field is set. + */ + boolean hasTerminalCondition(); + /** + * + * + *
+   * Output only. The Condition of this Job, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The terminalCondition. + */ + com.google.cloud.run.v2.Condition getTerminalCondition(); + /** + * + * + *
+   * Output only. The Condition of this Job, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * .google.cloud.run.v2.Condition terminal_condition = 18 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.run.v2.ConditionOrBuilder getTerminalConditionOrBuilder(); + + /** + * + * + *
+   * Output only. The Conditions of all other associated sub-resources. They contain
+   * additional diagnostics information in case the Job does not reach its
+   * desired state. See comments in `reconciling` for additional information on
+   * reconciliation process in Cloud Run.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.List getConditionsList(); + /** + * + * + *
+   * Output only. The Conditions of all other associated sub-resources. They contain
+   * additional diagnostics information in case the Job does not reach its
+   * desired state. See comments in `reconciling` for additional information on
+   * reconciliation process in Cloud Run.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.run.v2.Condition getConditions(int index); + /** + * + * + *
+   * Output only. The Conditions of all other associated sub-resources. They contain
+   * additional diagnostics information in case the Job does not reach its
+   * desired state. See comments in `reconciling` for additional information on
+   * reconciliation process in Cloud Run.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + int getConditionsCount(); + /** + * + * + *
+   * Output only. The Conditions of all other associated sub-resources. They contain
+   * additional diagnostics information in case the Job does not reach its
+   * desired state. See comments in `reconciling` for additional information on
+   * reconciliation process in Cloud Run.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.List getConditionsOrBuilderList(); + /** + * + * + *
+   * Output only. The Conditions of all other associated sub-resources. They contain
+   * additional diagnostics information in case the Job does not reach its
+   * desired state. See comments in `reconciling` for additional information on
+   * reconciliation process in Cloud Run.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.run.v2.ConditionOrBuilder getConditionsOrBuilder(int index); + + /** + * + * + *
+   * Output only. Number of executions created for this job.
+   * 
+ * + * int32 execution_count = 20 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The executionCount. + */ + int getExecutionCount(); + + /** + * + * + *
+   * Output only. Name of the last created execution.
+   * 
+ * + * + * .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the latestCreatedExecution field is set. + */ + boolean hasLatestCreatedExecution(); + /** + * + * + *
+   * Output only. Name of the last created execution.
+   * 
+ * + * + * .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The latestCreatedExecution. + */ + com.google.cloud.run.v2.ExecutionReference getLatestCreatedExecution(); + /** + * + * + *
+   * Output only. Name of the last created execution.
+   * 
+ * + * + * .google.cloud.run.v2.ExecutionReference latest_created_execution = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.run.v2.ExecutionReferenceOrBuilder getLatestCreatedExecutionOrBuilder(); + + /** + * + * + *
+   * Output only. Returns true if the Job is currently being acted upon by the system to
+   * bring it into the desired state.
+   * When a new Job is created, or an existing one is updated, Cloud Run
+   * will asynchronously perform all necessary steps to bring the Job to the
+   * desired state. This process is called reconciliation.
+   * While reconciliation is in process, `observed_generation` and
+   * `latest_succeeded_execution`, will have transient values that might
+   * mismatch the intended state: Once reconciliation is over (and this field is
+   * false), there are two possible outcomes: reconciliation succeeded and the
+   * state matches the Job, or there was an error,  and reconciliation failed.
+   * This state can be found in `terminal_condition.state`.
+   * If reconciliation succeeded, the following fields will match:
+   * `observed_generation` and `generation`, `latest_succeeded_execution` and
+   * `latest_created_execution`.
+   * If reconciliation failed, `observed_generation` and
+   * `latest_succeeded_execution` will have the state of the last succeeded
+   * execution or empty for newly created Job. Additional information on the
+   * failure can be found in `terminal_condition` and `conditions`.
+   * 
+ * + * bool reconciling = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + boolean getReconciling(); + + /** + * + * + *
+   * Output only. A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * Output only. A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobProto.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobProto.java new file mode 100644 index 000000000000..8c6298825459 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/JobProto.java @@ -0,0 +1,341 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +public final class JobProto { + private JobProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_CreateJobRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_CreateJobRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_GetJobRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_GetJobRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_UpdateJobRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_UpdateJobRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_ListJobsRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_ListJobsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_ListJobsResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_ListJobsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_DeleteJobRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_DeleteJobRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_RunJobRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_RunJobRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_Job_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_Job_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_Job_LabelsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_Job_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_Job_AnnotationsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_Job_AnnotationsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_ExecutionReference_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_ExecutionReference_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n\035google/cloud/run/v2/job.proto\022\023google." + + "cloud.run.v2\032\034google/api/annotations.pro" + + "to\032\027google/api/client.proto\032\037google/api/" + + "field_behavior.proto\032\035google/api/launch_" + + "stage.proto\032\031google/api/resource.proto\032#" + + "google/cloud/run/v2/condition.proto\032,goo" + + "gle/cloud/run/v2/execution_template.prot" + + "o\032)google/cloud/run/v2/vendor_settings.p" + + "roto\032\036google/iam/v1/iam_policy.proto\032\032go" + + "ogle/iam/v1/policy.proto\032#google/longrun" + + "ning/operations.proto\032\037google/protobuf/t" + + "imestamp.proto\"\232\001\n\020CreateJobRequest\022.\n\006p" + + "arent\030\001 \001(\tB\036\340A\002\372A\030\022\026run.googleapis.com/" + + "Job\022*\n\003job\030\002 \001(\0132\030.google.cloud.run.v2.J" + + "obB\003\340A\002\022\023\n\006job_id\030\003 \001(\tB\003\340A\002\022\025\n\rvalidate" + + "_only\030\004 \001(\010\"=\n\rGetJobRequest\022,\n\004name\030\001 \001" + + "(\tB\036\340A\002\372A\030\n\026run.googleapis.com/Job\"l\n\020Up" + + "dateJobRequest\022*\n\003job\030\001 \001(\0132\030.google.clo" + + "ud.run.v2.JobB\003\340A\002\022\025\n\rvalidate_only\030\003 \001(" + + "\010\022\025\n\rallow_missing\030\004 \001(\010\"~\n\017ListJobsRequ" + + "est\022.\n\006parent\030\001 \001(\tB\036\340A\002\372A\030\022\026run.googlea" + + "pis.com/Job\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_t" + + "oken\030\003 \001(\t\022\024\n\014show_deleted\030\004 \001(\010\"S\n\020List" + + "JobsResponse\022&\n\004jobs\030\001 \003(\0132\030.google.clou" + + "d.run.v2.Job\022\027\n\017next_page_token\030\002 \001(\t\"e\n" + + "\020DeleteJobRequest\022,\n\004name\030\001 \001(\tB\036\340A\002\372A\030\n" + + "\026run.googleapis.com/Job\022\025\n\rvalidate_only" + + "\030\003 \001(\010\022\014\n\004etag\030\004 \001(\t\"b\n\rRunJobRequest\022,\n" + + "\004name\030\001 \001(\tB\036\340A\002\372A\030\n\026run.googleapis.com/" + + "Job\022\025\n\rvalidate_only\030\002 \001(\010\022\014\n\004etag\030\003 \001(\t" + + "\"\212\t\n\003Job\022\014\n\004name\030\001 \001(\t\022\020\n\003uid\030\002 \001(\tB\003\340A\003" + + "\022\027\n\ngeneration\030\003 \001(\003B\003\340A\003\0224\n\006labels\030\004 \003(" + + "\0132$.google.cloud.run.v2.Job.LabelsEntry\022" + + ">\n\013annotations\030\005 \003(\0132).google.cloud.run." + + "v2.Job.AnnotationsEntry\0224\n\013create_time\030\006" + + " \001(\0132\032.google.protobuf.TimestampB\003\340A\003\0224\n" + + "\013update_time\030\007 \001(\0132\032.google.protobuf.Tim" + + "estampB\003\340A\003\0224\n\013delete_time\030\010 \001(\0132\032.googl" + + "e.protobuf.TimestampB\003\340A\003\0224\n\013expire_time" + + "\030\t \001(\0132\032.google.protobuf.TimestampB\003\340A\003\022" + + "\024\n\007creator\030\n \001(\tB\003\340A\003\022\032\n\rlast_modifier\030\013" + + " \001(\tB\003\340A\003\022\016\n\006client\030\014 \001(\t\022\026\n\016client_vers" + + "ion\030\r \001(\t\022-\n\014launch_stage\030\016 \001(\0162\027.google" + + ".api.LaunchStage\022F\n\024binary_authorization" + + "\030\017 \001(\0132(.google.cloud.run.v2.BinaryAutho" + + "rization\022=\n\010template\030\020 \001(\0132&.google.clou" + + "d.run.v2.ExecutionTemplateB\003\340A\002\022 \n\023obser" + + "ved_generation\030\021 \001(\003B\003\340A\003\022?\n\022terminal_co" + + "ndition\030\022 \001(\0132\036.google.cloud.run.v2.Cond" + + "itionB\003\340A\003\0227\n\nconditions\030\023 \003(\0132\036.google." + + "cloud.run.v2.ConditionB\003\340A\003\022\034\n\017execution" + + "_count\030\024 \001(\005B\003\340A\003\022N\n\030latest_created_exec" + + "ution\030\026 \001(\0132\'.google.cloud.run.v2.Execut" + + "ionReferenceB\003\340A\003\022\030\n\013reconciling\030\027 \001(\010B\003" + + "\340A\003\022\021\n\004etag\030c \001(\tB\003\340A\003\032-\n\013LabelsEntry\022\013\n" + + "\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\0322\n\020Annotat" + + "ionsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028" + + "\001:R\352AO\n\026run.googleapis.com/Job\0222projects" + + "/{project}/locations/{location}/jobs/{jo" + + "b}R\001\001\"\253\001\n\022ExecutionReference\022/\n\004name\030\001 \001" + + "(\tB!\372A\036\n\034run.googleapis.com/Execution\022/\n" + + "\013create_time\030\002 \001(\0132\032.google.protobuf.Tim" + + "estamp\0223\n\017completion_time\030\003 \001(\0132\032.google" + + ".protobuf.Timestamp2\314\013\n\004Jobs\022\251\001\n\tCreateJ" + + "ob\022%.google.cloud.run.v2.CreateJobReques" + + "t\032\035.google.longrunning.Operation\"V\202\323\344\223\002/" + + "\"(/v2/{parent=projects/*/locations/*}/jo" + + "bs:\003job\332A\021parent,job,job_id\312A\n\n\003Job\022\003Job" + + "\022\177\n\006GetJob\022\".google.cloud.run.v2.GetJobR" + + "equest\032\030.google.cloud.run.v2.Job\"7\202\323\344\223\002*" + + "\022(/v2/{name=projects/*/locations/*/jobs/" + + "*}\332A\004name\022\222\001\n\010ListJobs\022$.google.cloud.ru" + + "n.v2.ListJobsRequest\032%.google.cloud.run." + + "v2.ListJobsResponse\"9\202\323\344\223\002*\022(/v2/{parent" + + "=projects/*/locations/*}/jobs\332A\006parent\022\237" + + "\001\n\tUpdateJob\022%.google.cloud.run.v2.Updat" + + "eJobRequest\032\035.google.longrunning.Operati" + + "on\"L\202\323\344\223\00232,/v2/{job.name=projects/*/loc" + + "ations/*/jobs/*}:\003job\332A\003job\312A\n\n\003Job\022\003Job" + + "\022\227\001\n\tDeleteJob\022%.google.cloud.run.v2.Del" + + "eteJobRequest\032\035.google.longrunning.Opera" + + "tion\"D\202\323\344\223\002**(/v2/{name=projects/*/locat" + + "ions/*/jobs/*}\332A\004name\312A\n\n\003Job\022\003Job\022\244\001\n\006R" + + "unJob\022\".google.cloud.run.v2.RunJobReques" + + "t\032\035.google.longrunning.Operation\"W\202\323\344\223\0021" + + "\",/v2/{name=projects/*/locations/*/jobs/" + + "*}:run:\001*\332A\004name\312A\026\n\tExecution\022\tExecutio" + + "n\022\214\001\n\014GetIamPolicy\022\".google.iam.v1.GetIa" + + "mPolicyRequest\032\025.google.iam.v1.Policy\"A\202" + + "\323\344\223\002;\0229/v2/{resource=projects/*/location" + + "s/*/jobs/*}:getIamPolicy\022\217\001\n\014SetIamPolic" + + "y\022\".google.iam.v1.SetIamPolicyRequest\032\025." + + "google.iam.v1.Policy\"D\202\323\344\223\002>\"9/v2/{resou" + + "rce=projects/*/locations/*/jobs/*}:setIa" + + "mPolicy:\001*\022\265\001\n\022TestIamPermissions\022(.goog" + + "le.iam.v1.TestIamPermissionsRequest\032).go" + + "ogle.iam.v1.TestIamPermissionsResponse\"J" + + "\202\323\344\223\002D\"?/v2/{resource=projects/*/locatio" + + "ns/*/jobs/*}:testIamPermissions:\001*\032F\312A\022r" + + "un.googleapis.com\322A.https://www.googleap" + + "is.com/auth/cloud-platformB]\n\027com.google" + + ".cloud.run.v2B\010JobProtoP\001Z6google.golang" + + ".org/genproto/googleapis/cloud/run/v2;ru" + + "nb\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.LaunchStageProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.cloud.run.v2.ConditionProto.getDescriptor(), + com.google.cloud.run.v2.ExecutionTemplateProto.getDescriptor(), + com.google.cloud.run.v2.VendorSettingsProto.getDescriptor(), + com.google.iam.v1.IamPolicyProto.getDescriptor(), + com.google.iam.v1.PolicyProto.getDescriptor(), + com.google.longrunning.OperationsProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + }); + internal_static_google_cloud_run_v2_CreateJobRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_run_v2_CreateJobRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_CreateJobRequest_descriptor, + new java.lang.String[] { + "Parent", "Job", "JobId", "ValidateOnly", + }); + internal_static_google_cloud_run_v2_GetJobRequest_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_run_v2_GetJobRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_GetJobRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_run_v2_UpdateJobRequest_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_run_v2_UpdateJobRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_UpdateJobRequest_descriptor, + new java.lang.String[] { + "Job", "ValidateOnly", "AllowMissing", + }); + internal_static_google_cloud_run_v2_ListJobsRequest_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_run_v2_ListJobsRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_ListJobsRequest_descriptor, + new java.lang.String[] { + "Parent", "PageSize", "PageToken", "ShowDeleted", + }); + internal_static_google_cloud_run_v2_ListJobsResponse_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_run_v2_ListJobsResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_ListJobsResponse_descriptor, + new java.lang.String[] { + "Jobs", "NextPageToken", + }); + internal_static_google_cloud_run_v2_DeleteJobRequest_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_run_v2_DeleteJobRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_DeleteJobRequest_descriptor, + new java.lang.String[] { + "Name", "ValidateOnly", "Etag", + }); + internal_static_google_cloud_run_v2_RunJobRequest_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_run_v2_RunJobRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_RunJobRequest_descriptor, + new java.lang.String[] { + "Name", "ValidateOnly", "Etag", + }); + internal_static_google_cloud_run_v2_Job_descriptor = getDescriptor().getMessageTypes().get(7); + internal_static_google_cloud_run_v2_Job_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_Job_descriptor, + new java.lang.String[] { + "Name", + "Uid", + "Generation", + "Labels", + "Annotations", + "CreateTime", + "UpdateTime", + "DeleteTime", + "ExpireTime", + "Creator", + "LastModifier", + "Client", + "ClientVersion", + "LaunchStage", + "BinaryAuthorization", + "Template", + "ObservedGeneration", + "TerminalCondition", + "Conditions", + "ExecutionCount", + "LatestCreatedExecution", + "Reconciling", + "Etag", + }); + internal_static_google_cloud_run_v2_Job_LabelsEntry_descriptor = + internal_static_google_cloud_run_v2_Job_descriptor.getNestedTypes().get(0); + internal_static_google_cloud_run_v2_Job_LabelsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_Job_LabelsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_cloud_run_v2_Job_AnnotationsEntry_descriptor = + internal_static_google_cloud_run_v2_Job_descriptor.getNestedTypes().get(1); + internal_static_google_cloud_run_v2_Job_AnnotationsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_Job_AnnotationsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_cloud_run_v2_ExecutionReference_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_google_cloud_run_v2_ExecutionReference_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_ExecutionReference_descriptor, + new java.lang.String[] { + "Name", "CreateTime", "CompletionTime", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.methodSignature); + registry.add(com.google.api.ClientProto.oauthScopes); + registry.add(com.google.api.ResourceProto.resource); + registry.add(com.google.api.ResourceProto.resourceReference); + registry.add(com.google.longrunning.OperationsProto.operationInfo); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.LaunchStageProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.cloud.run.v2.ConditionProto.getDescriptor(); + com.google.cloud.run.v2.ExecutionTemplateProto.getDescriptor(); + com.google.cloud.run.v2.VendorSettingsProto.getDescriptor(); + com.google.iam.v1.IamPolicyProto.getDescriptor(); + com.google.iam.v1.PolicyProto.getDescriptor(); + com.google.longrunning.OperationsProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsRequest.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsRequest.java new file mode 100644 index 000000000000..208a4a70c96d --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsRequest.java @@ -0,0 +1,1009 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/execution.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Request message for retrieving a list of Executions.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.ListExecutionsRequest} + */ +public final class ListExecutionsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.ListExecutionsRequest) + ListExecutionsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListExecutionsRequest.newBuilder() to construct. + private ListExecutionsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListExecutionsRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListExecutionsRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_ListExecutionsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_ListExecutionsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ListExecutionsRequest.class, + com.google.cloud.run.v2.ListExecutionsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The Execution from which the Executions should be listed.
+   * To list all Executions across Jobs, use "-" instead of Job name.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The Execution from which the Executions should be listed.
+   * To list all Executions across Jobs, use "-" instead of Job name.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * Maximum number of Executions to return in this call.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * A page token received from a previous call to ListExecutions.
+   * All other parameters must match.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A page token received from a previous call to ListExecutions.
+   * All other parameters must match.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SHOW_DELETED_FIELD_NUMBER = 4; + private boolean showDeleted_; + /** + * + * + *
+   * If true, returns deleted (but unexpired) resources along with active ones.
+   * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + @java.lang.Override + public boolean getShowDeleted() { + return showDeleted_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + if (showDeleted_ != false) { + output.writeBool(4, showDeleted_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + if (showDeleted_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, showDeleted_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.ListExecutionsRequest)) { + return super.equals(obj); + } + com.google.cloud.run.v2.ListExecutionsRequest other = + (com.google.cloud.run.v2.ListExecutionsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (getShowDeleted() != other.getShowDeleted()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (37 * hash) + SHOW_DELETED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getShowDeleted()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.ListExecutionsRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListExecutionsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListExecutionsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListExecutionsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListExecutionsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListExecutionsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListExecutionsRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListExecutionsRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListExecutionsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListExecutionsRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListExecutionsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListExecutionsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.ListExecutionsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for retrieving a list of Executions.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.ListExecutionsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.ListExecutionsRequest) + com.google.cloud.run.v2.ListExecutionsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_ListExecutionsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_ListExecutionsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ListExecutionsRequest.class, + com.google.cloud.run.v2.ListExecutionsRequest.Builder.class); + } + + // Construct using com.google.cloud.run.v2.ListExecutionsRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + showDeleted_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_ListExecutionsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListExecutionsRequest getDefaultInstanceForType() { + return com.google.cloud.run.v2.ListExecutionsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.ListExecutionsRequest build() { + com.google.cloud.run.v2.ListExecutionsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListExecutionsRequest buildPartial() { + com.google.cloud.run.v2.ListExecutionsRequest result = + new com.google.cloud.run.v2.ListExecutionsRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + result.showDeleted_ = showDeleted_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.ListExecutionsRequest) { + return mergeFrom((com.google.cloud.run.v2.ListExecutionsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.ListExecutionsRequest other) { + if (other == com.google.cloud.run.v2.ListExecutionsRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + if (other.getShowDeleted() != false) { + setShowDeleted(other.getShowDeleted()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 16: + { + pageSize_ = input.readInt32(); + + break; + } // case 16 + case 26: + { + pageToken_ = input.readStringRequireUtf8(); + + break; + } // case 26 + case 32: + { + showDeleted_ = input.readBool(); + + break; + } // case 32 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The Execution from which the Executions should be listed.
+     * To list all Executions across Jobs, use "-" instead of Job name.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The Execution from which the Executions should be listed.
+     * To list all Executions across Jobs, use "-" instead of Job name.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The Execution from which the Executions should be listed.
+     * To list all Executions across Jobs, use "-" instead of Job name.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Execution from which the Executions should be listed.
+     * To list all Executions across Jobs, use "-" instead of Job name.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Execution from which the Executions should be listed.
+     * To list all Executions across Jobs, use "-" instead of Job name.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Maximum number of Executions to return in this call.
+     * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Maximum number of Executions to return in this call.
+     * 
+ * + * int32 page_size = 2; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Maximum number of Executions to return in this call.
+     * 
+ * + * int32 page_size = 2; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * A page token received from a previous call to ListExecutions.
+     * All other parameters must match.
+     * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A page token received from a previous call to ListExecutions.
+     * All other parameters must match.
+     * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A page token received from a previous call to ListExecutions.
+     * All other parameters must match.
+     * 
+ * + * string page_token = 3; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A page token received from a previous call to ListExecutions.
+     * All other parameters must match.
+     * 
+ * + * string page_token = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A page token received from a previous call to ListExecutions.
+     * All other parameters must match.
+     * 
+ * + * string page_token = 3; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + private boolean showDeleted_; + /** + * + * + *
+     * If true, returns deleted (but unexpired) resources along with active ones.
+     * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + @java.lang.Override + public boolean getShowDeleted() { + return showDeleted_; + } + /** + * + * + *
+     * If true, returns deleted (but unexpired) resources along with active ones.
+     * 
+ * + * bool show_deleted = 4; + * + * @param value The showDeleted to set. + * @return This builder for chaining. + */ + public Builder setShowDeleted(boolean value) { + + showDeleted_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If true, returns deleted (but unexpired) resources along with active ones.
+     * 
+ * + * bool show_deleted = 4; + * + * @return This builder for chaining. + */ + public Builder clearShowDeleted() { + + showDeleted_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.ListExecutionsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.ListExecutionsRequest) + private static final com.google.cloud.run.v2.ListExecutionsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.ListExecutionsRequest(); + } + + public static com.google.cloud.run.v2.ListExecutionsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListExecutionsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListExecutionsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsRequestOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsRequestOrBuilder.java new file mode 100644 index 000000000000..813d80c54f02 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsRequestOrBuilder.java @@ -0,0 +1,111 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/execution.proto + +package com.google.cloud.run.v2; + +public interface ListExecutionsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.ListExecutionsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The Execution from which the Executions should be listed.
+   * To list all Executions across Jobs, use "-" instead of Job name.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The Execution from which the Executions should be listed.
+   * To list all Executions across Jobs, use "-" instead of Job name.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Maximum number of Executions to return in this call.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * A page token received from a previous call to ListExecutions.
+   * All other parameters must match.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * A page token received from a previous call to ListExecutions.
+   * All other parameters must match.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * If true, returns deleted (but unexpired) resources along with active ones.
+   * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + boolean getShowDeleted(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsResponse.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsResponse.java new file mode 100644 index 000000000000..03ae07dcc6ac --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsResponse.java @@ -0,0 +1,1109 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/execution.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Response message containing a list of Executions.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.ListExecutionsResponse} + */ +public final class ListExecutionsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.ListExecutionsResponse) + ListExecutionsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListExecutionsResponse.newBuilder() to construct. + private ListExecutionsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListExecutionsResponse() { + executions_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListExecutionsResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_ListExecutionsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_ListExecutionsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ListExecutionsResponse.class, + com.google.cloud.run.v2.ListExecutionsResponse.Builder.class); + } + + public static final int EXECUTIONS_FIELD_NUMBER = 1; + private java.util.List executions_; + /** + * + * + *
+   * The resulting list of Executions.
+   * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + @java.lang.Override + public java.util.List getExecutionsList() { + return executions_; + } + /** + * + * + *
+   * The resulting list of Executions.
+   * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + @java.lang.Override + public java.util.List + getExecutionsOrBuilderList() { + return executions_; + } + /** + * + * + *
+   * The resulting list of Executions.
+   * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + @java.lang.Override + public int getExecutionsCount() { + return executions_.size(); + } + /** + * + * + *
+   * The resulting list of Executions.
+   * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + @java.lang.Override + public com.google.cloud.run.v2.Execution getExecutions(int index) { + return executions_.get(index); + } + /** + * + * + *
+   * The resulting list of Executions.
+   * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + @java.lang.Override + public com.google.cloud.run.v2.ExecutionOrBuilder getExecutionsOrBuilder(int index) { + return executions_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * A token indicating there are more items than page_size. Use it in the next
+   * ListExecutions request to continue.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A token indicating there are more items than page_size. Use it in the next
+   * ListExecutions request to continue.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < executions_.size(); i++) { + output.writeMessage(1, executions_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < executions_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, executions_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.ListExecutionsResponse)) { + return super.equals(obj); + } + com.google.cloud.run.v2.ListExecutionsResponse other = + (com.google.cloud.run.v2.ListExecutionsResponse) obj; + + if (!getExecutionsList().equals(other.getExecutionsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getExecutionsCount() > 0) { + hash = (37 * hash) + EXECUTIONS_FIELD_NUMBER; + hash = (53 * hash) + getExecutionsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.ListExecutionsResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListExecutionsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListExecutionsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListExecutionsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListExecutionsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListExecutionsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListExecutionsResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListExecutionsResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListExecutionsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListExecutionsResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListExecutionsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListExecutionsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.ListExecutionsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message containing a list of Executions.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.ListExecutionsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.ListExecutionsResponse) + com.google.cloud.run.v2.ListExecutionsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_ListExecutionsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_ListExecutionsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ListExecutionsResponse.class, + com.google.cloud.run.v2.ListExecutionsResponse.Builder.class); + } + + // Construct using com.google.cloud.run.v2.ListExecutionsResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (executionsBuilder_ == null) { + executions_ = java.util.Collections.emptyList(); + } else { + executions_ = null; + executionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.ExecutionProto + .internal_static_google_cloud_run_v2_ListExecutionsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListExecutionsResponse getDefaultInstanceForType() { + return com.google.cloud.run.v2.ListExecutionsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.ListExecutionsResponse build() { + com.google.cloud.run.v2.ListExecutionsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListExecutionsResponse buildPartial() { + com.google.cloud.run.v2.ListExecutionsResponse result = + new com.google.cloud.run.v2.ListExecutionsResponse(this); + int from_bitField0_ = bitField0_; + if (executionsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + executions_ = java.util.Collections.unmodifiableList(executions_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.executions_ = executions_; + } else { + result.executions_ = executionsBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.ListExecutionsResponse) { + return mergeFrom((com.google.cloud.run.v2.ListExecutionsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.ListExecutionsResponse other) { + if (other == com.google.cloud.run.v2.ListExecutionsResponse.getDefaultInstance()) return this; + if (executionsBuilder_ == null) { + if (!other.executions_.isEmpty()) { + if (executions_.isEmpty()) { + executions_ = other.executions_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureExecutionsIsMutable(); + executions_.addAll(other.executions_); + } + onChanged(); + } + } else { + if (!other.executions_.isEmpty()) { + if (executionsBuilder_.isEmpty()) { + executionsBuilder_.dispose(); + executionsBuilder_ = null; + executions_ = other.executions_; + bitField0_ = (bitField0_ & ~0x00000001); + executionsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getExecutionsFieldBuilder() + : null; + } else { + executionsBuilder_.addAllMessages(other.executions_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.run.v2.Execution m = + input.readMessage( + com.google.cloud.run.v2.Execution.parser(), extensionRegistry); + if (executionsBuilder_ == null) { + ensureExecutionsIsMutable(); + executions_.add(m); + } else { + executionsBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List executions_ = + java.util.Collections.emptyList(); + + private void ensureExecutionsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + executions_ = new java.util.ArrayList(executions_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Execution, + com.google.cloud.run.v2.Execution.Builder, + com.google.cloud.run.v2.ExecutionOrBuilder> + executionsBuilder_; + + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public java.util.List getExecutionsList() { + if (executionsBuilder_ == null) { + return java.util.Collections.unmodifiableList(executions_); + } else { + return executionsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public int getExecutionsCount() { + if (executionsBuilder_ == null) { + return executions_.size(); + } else { + return executionsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public com.google.cloud.run.v2.Execution getExecutions(int index) { + if (executionsBuilder_ == null) { + return executions_.get(index); + } else { + return executionsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public Builder setExecutions(int index, com.google.cloud.run.v2.Execution value) { + if (executionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureExecutionsIsMutable(); + executions_.set(index, value); + onChanged(); + } else { + executionsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public Builder setExecutions( + int index, com.google.cloud.run.v2.Execution.Builder builderForValue) { + if (executionsBuilder_ == null) { + ensureExecutionsIsMutable(); + executions_.set(index, builderForValue.build()); + onChanged(); + } else { + executionsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public Builder addExecutions(com.google.cloud.run.v2.Execution value) { + if (executionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureExecutionsIsMutable(); + executions_.add(value); + onChanged(); + } else { + executionsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public Builder addExecutions(int index, com.google.cloud.run.v2.Execution value) { + if (executionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureExecutionsIsMutable(); + executions_.add(index, value); + onChanged(); + } else { + executionsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public Builder addExecutions(com.google.cloud.run.v2.Execution.Builder builderForValue) { + if (executionsBuilder_ == null) { + ensureExecutionsIsMutable(); + executions_.add(builderForValue.build()); + onChanged(); + } else { + executionsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public Builder addExecutions( + int index, com.google.cloud.run.v2.Execution.Builder builderForValue) { + if (executionsBuilder_ == null) { + ensureExecutionsIsMutable(); + executions_.add(index, builderForValue.build()); + onChanged(); + } else { + executionsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public Builder addAllExecutions( + java.lang.Iterable values) { + if (executionsBuilder_ == null) { + ensureExecutionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, executions_); + onChanged(); + } else { + executionsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public Builder clearExecutions() { + if (executionsBuilder_ == null) { + executions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + executionsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public Builder removeExecutions(int index) { + if (executionsBuilder_ == null) { + ensureExecutionsIsMutable(); + executions_.remove(index); + onChanged(); + } else { + executionsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public com.google.cloud.run.v2.Execution.Builder getExecutionsBuilder(int index) { + return getExecutionsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public com.google.cloud.run.v2.ExecutionOrBuilder getExecutionsOrBuilder(int index) { + if (executionsBuilder_ == null) { + return executions_.get(index); + } else { + return executionsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public java.util.List + getExecutionsOrBuilderList() { + if (executionsBuilder_ != null) { + return executionsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(executions_); + } + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public com.google.cloud.run.v2.Execution.Builder addExecutionsBuilder() { + return getExecutionsFieldBuilder() + .addBuilder(com.google.cloud.run.v2.Execution.getDefaultInstance()); + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public com.google.cloud.run.v2.Execution.Builder addExecutionsBuilder(int index) { + return getExecutionsFieldBuilder() + .addBuilder(index, com.google.cloud.run.v2.Execution.getDefaultInstance()); + } + /** + * + * + *
+     * The resulting list of Executions.
+     * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + public java.util.List getExecutionsBuilderList() { + return getExecutionsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Execution, + com.google.cloud.run.v2.Execution.Builder, + com.google.cloud.run.v2.ExecutionOrBuilder> + getExecutionsFieldBuilder() { + if (executionsBuilder_ == null) { + executionsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Execution, + com.google.cloud.run.v2.Execution.Builder, + com.google.cloud.run.v2.ExecutionOrBuilder>( + executions_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + executions_ = null; + } + return executionsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A token indicating there are more items than page_size. Use it in the next
+     * ListExecutions request to continue.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token indicating there are more items than page_size. Use it in the next
+     * ListExecutions request to continue.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token indicating there are more items than page_size. Use it in the next
+     * ListExecutions request to continue.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token indicating there are more items than page_size. Use it in the next
+     * ListExecutions request to continue.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token indicating there are more items than page_size. Use it in the next
+     * ListExecutions request to continue.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.ListExecutionsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.ListExecutionsResponse) + private static final com.google.cloud.run.v2.ListExecutionsResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.ListExecutionsResponse(); + } + + public static com.google.cloud.run.v2.ListExecutionsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListExecutionsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListExecutionsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsResponseOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsResponseOrBuilder.java new file mode 100644 index 000000000000..31fea6256bb6 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListExecutionsResponseOrBuilder.java @@ -0,0 +1,103 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/execution.proto + +package com.google.cloud.run.v2; + +public interface ListExecutionsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.ListExecutionsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The resulting list of Executions.
+   * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + java.util.List getExecutionsList(); + /** + * + * + *
+   * The resulting list of Executions.
+   * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + com.google.cloud.run.v2.Execution getExecutions(int index); + /** + * + * + *
+   * The resulting list of Executions.
+   * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + int getExecutionsCount(); + /** + * + * + *
+   * The resulting list of Executions.
+   * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + java.util.List getExecutionsOrBuilderList(); + /** + * + * + *
+   * The resulting list of Executions.
+   * 
+ * + * repeated .google.cloud.run.v2.Execution executions = 1; + */ + com.google.cloud.run.v2.ExecutionOrBuilder getExecutionsOrBuilder(int index); + + /** + * + * + *
+   * A token indicating there are more items than page_size. Use it in the next
+   * ListExecutions request to continue.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A token indicating there are more items than page_size. Use it in the next
+   * ListExecutions request to continue.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsRequest.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsRequest.java new file mode 100644 index 000000000000..5e31540f8410 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsRequest.java @@ -0,0 +1,1001 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Request message for retrieving a list of Jobs.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.ListJobsRequest} + */ +public final class ListJobsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.ListJobsRequest) + ListJobsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListJobsRequest.newBuilder() to construct. + private ListJobsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListJobsRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListJobsRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_ListJobsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_ListJobsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ListJobsRequest.class, + com.google.cloud.run.v2.ListJobsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The location and project to list resources on.
+   * Format: projects/{project}/locations/{location}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The location and project to list resources on.
+   * Format: projects/{project}/locations/{location}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * Maximum number of Jobs to return in this call.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * A page token received from a previous call to ListJobs.
+   * All other parameters must match.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A page token received from a previous call to ListJobs.
+   * All other parameters must match.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SHOW_DELETED_FIELD_NUMBER = 4; + private boolean showDeleted_; + /** + * + * + *
+   * If true, returns deleted (but unexpired) resources along with active ones.
+   * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + @java.lang.Override + public boolean getShowDeleted() { + return showDeleted_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + if (showDeleted_ != false) { + output.writeBool(4, showDeleted_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + if (showDeleted_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, showDeleted_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.ListJobsRequest)) { + return super.equals(obj); + } + com.google.cloud.run.v2.ListJobsRequest other = (com.google.cloud.run.v2.ListJobsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (getShowDeleted() != other.getShowDeleted()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (37 * hash) + SHOW_DELETED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getShowDeleted()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.ListJobsRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListJobsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListJobsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListJobsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListJobsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListJobsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListJobsRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListJobsRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListJobsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListJobsRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListJobsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListJobsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.ListJobsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for retrieving a list of Jobs.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.ListJobsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.ListJobsRequest) + com.google.cloud.run.v2.ListJobsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_ListJobsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_ListJobsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ListJobsRequest.class, + com.google.cloud.run.v2.ListJobsRequest.Builder.class); + } + + // Construct using com.google.cloud.run.v2.ListJobsRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + showDeleted_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_ListJobsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListJobsRequest getDefaultInstanceForType() { + return com.google.cloud.run.v2.ListJobsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.ListJobsRequest build() { + com.google.cloud.run.v2.ListJobsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListJobsRequest buildPartial() { + com.google.cloud.run.v2.ListJobsRequest result = + new com.google.cloud.run.v2.ListJobsRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + result.showDeleted_ = showDeleted_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.ListJobsRequest) { + return mergeFrom((com.google.cloud.run.v2.ListJobsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.ListJobsRequest other) { + if (other == com.google.cloud.run.v2.ListJobsRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + if (other.getShowDeleted() != false) { + setShowDeleted(other.getShowDeleted()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 16: + { + pageSize_ = input.readInt32(); + + break; + } // case 16 + case 26: + { + pageToken_ = input.readStringRequireUtf8(); + + break; + } // case 26 + case 32: + { + showDeleted_ = input.readBool(); + + break; + } // case 32 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The location and project to list resources on.
+     * Format: projects/{project}/locations/{location}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The location and project to list resources on.
+     * Format: projects/{project}/locations/{location}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The location and project to list resources on.
+     * Format: projects/{project}/locations/{location}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The location and project to list resources on.
+     * Format: projects/{project}/locations/{location}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The location and project to list resources on.
+     * Format: projects/{project}/locations/{location}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Maximum number of Jobs to return in this call.
+     * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Maximum number of Jobs to return in this call.
+     * 
+ * + * int32 page_size = 2; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Maximum number of Jobs to return in this call.
+     * 
+ * + * int32 page_size = 2; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * A page token received from a previous call to ListJobs.
+     * All other parameters must match.
+     * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A page token received from a previous call to ListJobs.
+     * All other parameters must match.
+     * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A page token received from a previous call to ListJobs.
+     * All other parameters must match.
+     * 
+ * + * string page_token = 3; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A page token received from a previous call to ListJobs.
+     * All other parameters must match.
+     * 
+ * + * string page_token = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A page token received from a previous call to ListJobs.
+     * All other parameters must match.
+     * 
+ * + * string page_token = 3; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + private boolean showDeleted_; + /** + * + * + *
+     * If true, returns deleted (but unexpired) resources along with active ones.
+     * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + @java.lang.Override + public boolean getShowDeleted() { + return showDeleted_; + } + /** + * + * + *
+     * If true, returns deleted (but unexpired) resources along with active ones.
+     * 
+ * + * bool show_deleted = 4; + * + * @param value The showDeleted to set. + * @return This builder for chaining. + */ + public Builder setShowDeleted(boolean value) { + + showDeleted_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If true, returns deleted (but unexpired) resources along with active ones.
+     * 
+ * + * bool show_deleted = 4; + * + * @return This builder for chaining. + */ + public Builder clearShowDeleted() { + + showDeleted_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.ListJobsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.ListJobsRequest) + private static final com.google.cloud.run.v2.ListJobsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.ListJobsRequest(); + } + + public static com.google.cloud.run.v2.ListJobsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListJobsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListJobsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsRequestOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsRequestOrBuilder.java new file mode 100644 index 000000000000..f0c11bcabdec --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsRequestOrBuilder.java @@ -0,0 +1,109 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +public interface ListJobsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.ListJobsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The location and project to list resources on.
+   * Format: projects/{project}/locations/{location}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The location and project to list resources on.
+   * Format: projects/{project}/locations/{location}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Maximum number of Jobs to return in this call.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * A page token received from a previous call to ListJobs.
+   * All other parameters must match.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * A page token received from a previous call to ListJobs.
+   * All other parameters must match.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * If true, returns deleted (but unexpired) resources along with active ones.
+   * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + boolean getShowDeleted(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsResponse.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsResponse.java new file mode 100644 index 000000000000..0dd735ab4411 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsResponse.java @@ -0,0 +1,1100 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Response message containing a list of Jobs.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.ListJobsResponse} + */ +public final class ListJobsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.ListJobsResponse) + ListJobsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListJobsResponse.newBuilder() to construct. + private ListJobsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListJobsResponse() { + jobs_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListJobsResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_ListJobsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_ListJobsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ListJobsResponse.class, + com.google.cloud.run.v2.ListJobsResponse.Builder.class); + } + + public static final int JOBS_FIELD_NUMBER = 1; + private java.util.List jobs_; + /** + * + * + *
+   * The resulting list of Jobs.
+   * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + @java.lang.Override + public java.util.List getJobsList() { + return jobs_; + } + /** + * + * + *
+   * The resulting list of Jobs.
+   * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + @java.lang.Override + public java.util.List getJobsOrBuilderList() { + return jobs_; + } + /** + * + * + *
+   * The resulting list of Jobs.
+   * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + @java.lang.Override + public int getJobsCount() { + return jobs_.size(); + } + /** + * + * + *
+   * The resulting list of Jobs.
+   * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + @java.lang.Override + public com.google.cloud.run.v2.Job getJobs(int index) { + return jobs_.get(index); + } + /** + * + * + *
+   * The resulting list of Jobs.
+   * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + @java.lang.Override + public com.google.cloud.run.v2.JobOrBuilder getJobsOrBuilder(int index) { + return jobs_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * A token indicating there are more items than page_size. Use it in the next
+   * ListJobs request to continue.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A token indicating there are more items than page_size. Use it in the next
+   * ListJobs request to continue.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < jobs_.size(); i++) { + output.writeMessage(1, jobs_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < jobs_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, jobs_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.ListJobsResponse)) { + return super.equals(obj); + } + com.google.cloud.run.v2.ListJobsResponse other = (com.google.cloud.run.v2.ListJobsResponse) obj; + + if (!getJobsList().equals(other.getJobsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getJobsCount() > 0) { + hash = (37 * hash) + JOBS_FIELD_NUMBER; + hash = (53 * hash) + getJobsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.ListJobsResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListJobsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListJobsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListJobsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListJobsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListJobsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListJobsResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListJobsResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListJobsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListJobsResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListJobsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListJobsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.ListJobsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message containing a list of Jobs.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.ListJobsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.ListJobsResponse) + com.google.cloud.run.v2.ListJobsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_ListJobsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_ListJobsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ListJobsResponse.class, + com.google.cloud.run.v2.ListJobsResponse.Builder.class); + } + + // Construct using com.google.cloud.run.v2.ListJobsResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (jobsBuilder_ == null) { + jobs_ = java.util.Collections.emptyList(); + } else { + jobs_ = null; + jobsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_ListJobsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListJobsResponse getDefaultInstanceForType() { + return com.google.cloud.run.v2.ListJobsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.ListJobsResponse build() { + com.google.cloud.run.v2.ListJobsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListJobsResponse buildPartial() { + com.google.cloud.run.v2.ListJobsResponse result = + new com.google.cloud.run.v2.ListJobsResponse(this); + int from_bitField0_ = bitField0_; + if (jobsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + jobs_ = java.util.Collections.unmodifiableList(jobs_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.jobs_ = jobs_; + } else { + result.jobs_ = jobsBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.ListJobsResponse) { + return mergeFrom((com.google.cloud.run.v2.ListJobsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.ListJobsResponse other) { + if (other == com.google.cloud.run.v2.ListJobsResponse.getDefaultInstance()) return this; + if (jobsBuilder_ == null) { + if (!other.jobs_.isEmpty()) { + if (jobs_.isEmpty()) { + jobs_ = other.jobs_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureJobsIsMutable(); + jobs_.addAll(other.jobs_); + } + onChanged(); + } + } else { + if (!other.jobs_.isEmpty()) { + if (jobsBuilder_.isEmpty()) { + jobsBuilder_.dispose(); + jobsBuilder_ = null; + jobs_ = other.jobs_; + bitField0_ = (bitField0_ & ~0x00000001); + jobsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getJobsFieldBuilder() + : null; + } else { + jobsBuilder_.addAllMessages(other.jobs_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.run.v2.Job m = + input.readMessage(com.google.cloud.run.v2.Job.parser(), extensionRegistry); + if (jobsBuilder_ == null) { + ensureJobsIsMutable(); + jobs_.add(m); + } else { + jobsBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List jobs_ = java.util.Collections.emptyList(); + + private void ensureJobsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + jobs_ = new java.util.ArrayList(jobs_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Job, + com.google.cloud.run.v2.Job.Builder, + com.google.cloud.run.v2.JobOrBuilder> + jobsBuilder_; + + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public java.util.List getJobsList() { + if (jobsBuilder_ == null) { + return java.util.Collections.unmodifiableList(jobs_); + } else { + return jobsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public int getJobsCount() { + if (jobsBuilder_ == null) { + return jobs_.size(); + } else { + return jobsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public com.google.cloud.run.v2.Job getJobs(int index) { + if (jobsBuilder_ == null) { + return jobs_.get(index); + } else { + return jobsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public Builder setJobs(int index, com.google.cloud.run.v2.Job value) { + if (jobsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureJobsIsMutable(); + jobs_.set(index, value); + onChanged(); + } else { + jobsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public Builder setJobs(int index, com.google.cloud.run.v2.Job.Builder builderForValue) { + if (jobsBuilder_ == null) { + ensureJobsIsMutable(); + jobs_.set(index, builderForValue.build()); + onChanged(); + } else { + jobsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public Builder addJobs(com.google.cloud.run.v2.Job value) { + if (jobsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureJobsIsMutable(); + jobs_.add(value); + onChanged(); + } else { + jobsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public Builder addJobs(int index, com.google.cloud.run.v2.Job value) { + if (jobsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureJobsIsMutable(); + jobs_.add(index, value); + onChanged(); + } else { + jobsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public Builder addJobs(com.google.cloud.run.v2.Job.Builder builderForValue) { + if (jobsBuilder_ == null) { + ensureJobsIsMutable(); + jobs_.add(builderForValue.build()); + onChanged(); + } else { + jobsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public Builder addJobs(int index, com.google.cloud.run.v2.Job.Builder builderForValue) { + if (jobsBuilder_ == null) { + ensureJobsIsMutable(); + jobs_.add(index, builderForValue.build()); + onChanged(); + } else { + jobsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public Builder addAllJobs(java.lang.Iterable values) { + if (jobsBuilder_ == null) { + ensureJobsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, jobs_); + onChanged(); + } else { + jobsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public Builder clearJobs() { + if (jobsBuilder_ == null) { + jobs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + jobsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public Builder removeJobs(int index) { + if (jobsBuilder_ == null) { + ensureJobsIsMutable(); + jobs_.remove(index); + onChanged(); + } else { + jobsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public com.google.cloud.run.v2.Job.Builder getJobsBuilder(int index) { + return getJobsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public com.google.cloud.run.v2.JobOrBuilder getJobsOrBuilder(int index) { + if (jobsBuilder_ == null) { + return jobs_.get(index); + } else { + return jobsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public java.util.List getJobsOrBuilderList() { + if (jobsBuilder_ != null) { + return jobsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(jobs_); + } + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public com.google.cloud.run.v2.Job.Builder addJobsBuilder() { + return getJobsFieldBuilder().addBuilder(com.google.cloud.run.v2.Job.getDefaultInstance()); + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public com.google.cloud.run.v2.Job.Builder addJobsBuilder(int index) { + return getJobsFieldBuilder() + .addBuilder(index, com.google.cloud.run.v2.Job.getDefaultInstance()); + } + /** + * + * + *
+     * The resulting list of Jobs.
+     * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + public java.util.List getJobsBuilderList() { + return getJobsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Job, + com.google.cloud.run.v2.Job.Builder, + com.google.cloud.run.v2.JobOrBuilder> + getJobsFieldBuilder() { + if (jobsBuilder_ == null) { + jobsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Job, + com.google.cloud.run.v2.Job.Builder, + com.google.cloud.run.v2.JobOrBuilder>( + jobs_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + jobs_ = null; + } + return jobsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A token indicating there are more items than page_size. Use it in the next
+     * ListJobs request to continue.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token indicating there are more items than page_size. Use it in the next
+     * ListJobs request to continue.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token indicating there are more items than page_size. Use it in the next
+     * ListJobs request to continue.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token indicating there are more items than page_size. Use it in the next
+     * ListJobs request to continue.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token indicating there are more items than page_size. Use it in the next
+     * ListJobs request to continue.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.ListJobsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.ListJobsResponse) + private static final com.google.cloud.run.v2.ListJobsResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.ListJobsResponse(); + } + + public static com.google.cloud.run.v2.ListJobsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListJobsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListJobsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsResponseOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsResponseOrBuilder.java new file mode 100644 index 000000000000..6663dd3b74b3 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListJobsResponseOrBuilder.java @@ -0,0 +1,103 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +public interface ListJobsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.ListJobsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The resulting list of Jobs.
+   * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + java.util.List getJobsList(); + /** + * + * + *
+   * The resulting list of Jobs.
+   * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + com.google.cloud.run.v2.Job getJobs(int index); + /** + * + * + *
+   * The resulting list of Jobs.
+   * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + int getJobsCount(); + /** + * + * + *
+   * The resulting list of Jobs.
+   * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + java.util.List getJobsOrBuilderList(); + /** + * + * + *
+   * The resulting list of Jobs.
+   * 
+ * + * repeated .google.cloud.run.v2.Job jobs = 1; + */ + com.google.cloud.run.v2.JobOrBuilder getJobsOrBuilder(int index); + + /** + * + * + *
+   * A token indicating there are more items than page_size. Use it in the next
+   * ListJobs request to continue.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A token indicating there are more items than page_size. Use it in the next
+   * ListJobs request to continue.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksRequest.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksRequest.java new file mode 100644 index 000000000000..a21654c8865c --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksRequest.java @@ -0,0 +1,1015 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/task.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Request message for retrieving a list of Tasks.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.ListTasksRequest} + */ +public final class ListTasksRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.ListTasksRequest) + ListTasksRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListTasksRequest.newBuilder() to construct. + private ListTasksRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListTasksRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListTasksRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_ListTasksRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_ListTasksRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ListTasksRequest.class, + com.google.cloud.run.v2.ListTasksRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The Execution from which the Tasks should be listed.
+   * To list all Tasks across Executions of a Job, use "-" instead of Execution
+   * name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The Execution from which the Tasks should be listed.
+   * To list all Tasks across Executions of a Job, use "-" instead of Execution
+   * name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * Maximum number of Tasks to return in this call.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * A page token received from a previous call to ListTasks.
+   * All other parameters must match.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A page token received from a previous call to ListTasks.
+   * All other parameters must match.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SHOW_DELETED_FIELD_NUMBER = 4; + private boolean showDeleted_; + /** + * + * + *
+   * If true, returns deleted (but unexpired) resources along with active ones.
+   * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + @java.lang.Override + public boolean getShowDeleted() { + return showDeleted_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + if (showDeleted_ != false) { + output.writeBool(4, showDeleted_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + if (showDeleted_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, showDeleted_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.ListTasksRequest)) { + return super.equals(obj); + } + com.google.cloud.run.v2.ListTasksRequest other = (com.google.cloud.run.v2.ListTasksRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (getShowDeleted() != other.getShowDeleted()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (37 * hash) + SHOW_DELETED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getShowDeleted()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.ListTasksRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListTasksRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListTasksRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListTasksRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListTasksRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListTasksRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListTasksRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListTasksRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListTasksRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListTasksRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListTasksRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListTasksRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.ListTasksRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for retrieving a list of Tasks.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.ListTasksRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.ListTasksRequest) + com.google.cloud.run.v2.ListTasksRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_ListTasksRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_ListTasksRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ListTasksRequest.class, + com.google.cloud.run.v2.ListTasksRequest.Builder.class); + } + + // Construct using com.google.cloud.run.v2.ListTasksRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + showDeleted_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_ListTasksRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListTasksRequest getDefaultInstanceForType() { + return com.google.cloud.run.v2.ListTasksRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.ListTasksRequest build() { + com.google.cloud.run.v2.ListTasksRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListTasksRequest buildPartial() { + com.google.cloud.run.v2.ListTasksRequest result = + new com.google.cloud.run.v2.ListTasksRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + result.showDeleted_ = showDeleted_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.ListTasksRequest) { + return mergeFrom((com.google.cloud.run.v2.ListTasksRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.ListTasksRequest other) { + if (other == com.google.cloud.run.v2.ListTasksRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + if (other.getShowDeleted() != false) { + setShowDeleted(other.getShowDeleted()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 16: + { + pageSize_ = input.readInt32(); + + break; + } // case 16 + case 26: + { + pageToken_ = input.readStringRequireUtf8(); + + break; + } // case 26 + case 32: + { + showDeleted_ = input.readBool(); + + break; + } // case 32 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The Execution from which the Tasks should be listed.
+     * To list all Tasks across Executions of a Job, use "-" instead of Execution
+     * name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The Execution from which the Tasks should be listed.
+     * To list all Tasks across Executions of a Job, use "-" instead of Execution
+     * name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The Execution from which the Tasks should be listed.
+     * To list all Tasks across Executions of a Job, use "-" instead of Execution
+     * name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Execution from which the Tasks should be listed.
+     * To list all Tasks across Executions of a Job, use "-" instead of Execution
+     * name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Execution from which the Tasks should be listed.
+     * To list all Tasks across Executions of a Job, use "-" instead of Execution
+     * name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
+     * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Maximum number of Tasks to return in this call.
+     * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Maximum number of Tasks to return in this call.
+     * 
+ * + * int32 page_size = 2; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Maximum number of Tasks to return in this call.
+     * 
+ * + * int32 page_size = 2; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * A page token received from a previous call to ListTasks.
+     * All other parameters must match.
+     * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A page token received from a previous call to ListTasks.
+     * All other parameters must match.
+     * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A page token received from a previous call to ListTasks.
+     * All other parameters must match.
+     * 
+ * + * string page_token = 3; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A page token received from a previous call to ListTasks.
+     * All other parameters must match.
+     * 
+ * + * string page_token = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A page token received from a previous call to ListTasks.
+     * All other parameters must match.
+     * 
+ * + * string page_token = 3; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + private boolean showDeleted_; + /** + * + * + *
+     * If true, returns deleted (but unexpired) resources along with active ones.
+     * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + @java.lang.Override + public boolean getShowDeleted() { + return showDeleted_; + } + /** + * + * + *
+     * If true, returns deleted (but unexpired) resources along with active ones.
+     * 
+ * + * bool show_deleted = 4; + * + * @param value The showDeleted to set. + * @return This builder for chaining. + */ + public Builder setShowDeleted(boolean value) { + + showDeleted_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If true, returns deleted (but unexpired) resources along with active ones.
+     * 
+ * + * bool show_deleted = 4; + * + * @return This builder for chaining. + */ + public Builder clearShowDeleted() { + + showDeleted_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.ListTasksRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.ListTasksRequest) + private static final com.google.cloud.run.v2.ListTasksRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.ListTasksRequest(); + } + + public static com.google.cloud.run.v2.ListTasksRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListTasksRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListTasksRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksRequestOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksRequestOrBuilder.java new file mode 100644 index 000000000000..1fbb9728d4ed --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksRequestOrBuilder.java @@ -0,0 +1,113 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/task.proto + +package com.google.cloud.run.v2; + +public interface ListTasksRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.ListTasksRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The Execution from which the Tasks should be listed.
+   * To list all Tasks across Executions of a Job, use "-" instead of Execution
+   * name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The Execution from which the Tasks should be listed.
+   * To list all Tasks across Executions of a Job, use "-" instead of Execution
+   * name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
+   * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Maximum number of Tasks to return in this call.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * A page token received from a previous call to ListTasks.
+   * All other parameters must match.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * A page token received from a previous call to ListTasks.
+   * All other parameters must match.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * If true, returns deleted (but unexpired) resources along with active ones.
+   * 
+ * + * bool show_deleted = 4; + * + * @return The showDeleted. + */ + boolean getShowDeleted(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksResponse.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksResponse.java new file mode 100644 index 000000000000..0a2a106742c5 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksResponse.java @@ -0,0 +1,1101 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/task.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Response message containing a list of Tasks.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.ListTasksResponse} + */ +public final class ListTasksResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.ListTasksResponse) + ListTasksResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListTasksResponse.newBuilder() to construct. + private ListTasksResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListTasksResponse() { + tasks_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListTasksResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_ListTasksResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_ListTasksResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ListTasksResponse.class, + com.google.cloud.run.v2.ListTasksResponse.Builder.class); + } + + public static final int TASKS_FIELD_NUMBER = 1; + private java.util.List tasks_; + /** + * + * + *
+   * The resulting list of Tasks.
+   * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + @java.lang.Override + public java.util.List getTasksList() { + return tasks_; + } + /** + * + * + *
+   * The resulting list of Tasks.
+   * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + @java.lang.Override + public java.util.List getTasksOrBuilderList() { + return tasks_; + } + /** + * + * + *
+   * The resulting list of Tasks.
+   * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + @java.lang.Override + public int getTasksCount() { + return tasks_.size(); + } + /** + * + * + *
+   * The resulting list of Tasks.
+   * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + @java.lang.Override + public com.google.cloud.run.v2.Task getTasks(int index) { + return tasks_.get(index); + } + /** + * + * + *
+   * The resulting list of Tasks.
+   * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + @java.lang.Override + public com.google.cloud.run.v2.TaskOrBuilder getTasksOrBuilder(int index) { + return tasks_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * A token indicating there are more items than page_size. Use it in the next
+   * ListTasks request to continue.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A token indicating there are more items than page_size. Use it in the next
+   * ListTasks request to continue.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < tasks_.size(); i++) { + output.writeMessage(1, tasks_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < tasks_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, tasks_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.ListTasksResponse)) { + return super.equals(obj); + } + com.google.cloud.run.v2.ListTasksResponse other = + (com.google.cloud.run.v2.ListTasksResponse) obj; + + if (!getTasksList().equals(other.getTasksList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getTasksCount() > 0) { + hash = (37 * hash) + TASKS_FIELD_NUMBER; + hash = (53 * hash) + getTasksList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.ListTasksResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListTasksResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListTasksResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListTasksResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListTasksResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.ListTasksResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListTasksResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListTasksResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListTasksResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListTasksResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.ListTasksResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.ListTasksResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.ListTasksResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message containing a list of Tasks.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.ListTasksResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.ListTasksResponse) + com.google.cloud.run.v2.ListTasksResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_ListTasksResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_ListTasksResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.ListTasksResponse.class, + com.google.cloud.run.v2.ListTasksResponse.Builder.class); + } + + // Construct using com.google.cloud.run.v2.ListTasksResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (tasksBuilder_ == null) { + tasks_ = java.util.Collections.emptyList(); + } else { + tasks_ = null; + tasksBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_ListTasksResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListTasksResponse getDefaultInstanceForType() { + return com.google.cloud.run.v2.ListTasksResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.ListTasksResponse build() { + com.google.cloud.run.v2.ListTasksResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListTasksResponse buildPartial() { + com.google.cloud.run.v2.ListTasksResponse result = + new com.google.cloud.run.v2.ListTasksResponse(this); + int from_bitField0_ = bitField0_; + if (tasksBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + tasks_ = java.util.Collections.unmodifiableList(tasks_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.tasks_ = tasks_; + } else { + result.tasks_ = tasksBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.ListTasksResponse) { + return mergeFrom((com.google.cloud.run.v2.ListTasksResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.ListTasksResponse other) { + if (other == com.google.cloud.run.v2.ListTasksResponse.getDefaultInstance()) return this; + if (tasksBuilder_ == null) { + if (!other.tasks_.isEmpty()) { + if (tasks_.isEmpty()) { + tasks_ = other.tasks_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureTasksIsMutable(); + tasks_.addAll(other.tasks_); + } + onChanged(); + } + } else { + if (!other.tasks_.isEmpty()) { + if (tasksBuilder_.isEmpty()) { + tasksBuilder_.dispose(); + tasksBuilder_ = null; + tasks_ = other.tasks_; + bitField0_ = (bitField0_ & ~0x00000001); + tasksBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getTasksFieldBuilder() + : null; + } else { + tasksBuilder_.addAllMessages(other.tasks_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.run.v2.Task m = + input.readMessage(com.google.cloud.run.v2.Task.parser(), extensionRegistry); + if (tasksBuilder_ == null) { + ensureTasksIsMutable(); + tasks_.add(m); + } else { + tasksBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List tasks_ = java.util.Collections.emptyList(); + + private void ensureTasksIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + tasks_ = new java.util.ArrayList(tasks_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Task, + com.google.cloud.run.v2.Task.Builder, + com.google.cloud.run.v2.TaskOrBuilder> + tasksBuilder_; + + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public java.util.List getTasksList() { + if (tasksBuilder_ == null) { + return java.util.Collections.unmodifiableList(tasks_); + } else { + return tasksBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public int getTasksCount() { + if (tasksBuilder_ == null) { + return tasks_.size(); + } else { + return tasksBuilder_.getCount(); + } + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public com.google.cloud.run.v2.Task getTasks(int index) { + if (tasksBuilder_ == null) { + return tasks_.get(index); + } else { + return tasksBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public Builder setTasks(int index, com.google.cloud.run.v2.Task value) { + if (tasksBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTasksIsMutable(); + tasks_.set(index, value); + onChanged(); + } else { + tasksBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public Builder setTasks(int index, com.google.cloud.run.v2.Task.Builder builderForValue) { + if (tasksBuilder_ == null) { + ensureTasksIsMutable(); + tasks_.set(index, builderForValue.build()); + onChanged(); + } else { + tasksBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public Builder addTasks(com.google.cloud.run.v2.Task value) { + if (tasksBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTasksIsMutable(); + tasks_.add(value); + onChanged(); + } else { + tasksBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public Builder addTasks(int index, com.google.cloud.run.v2.Task value) { + if (tasksBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTasksIsMutable(); + tasks_.add(index, value); + onChanged(); + } else { + tasksBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public Builder addTasks(com.google.cloud.run.v2.Task.Builder builderForValue) { + if (tasksBuilder_ == null) { + ensureTasksIsMutable(); + tasks_.add(builderForValue.build()); + onChanged(); + } else { + tasksBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public Builder addTasks(int index, com.google.cloud.run.v2.Task.Builder builderForValue) { + if (tasksBuilder_ == null) { + ensureTasksIsMutable(); + tasks_.add(index, builderForValue.build()); + onChanged(); + } else { + tasksBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public Builder addAllTasks(java.lang.Iterable values) { + if (tasksBuilder_ == null) { + ensureTasksIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, tasks_); + onChanged(); + } else { + tasksBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public Builder clearTasks() { + if (tasksBuilder_ == null) { + tasks_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + tasksBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public Builder removeTasks(int index) { + if (tasksBuilder_ == null) { + ensureTasksIsMutable(); + tasks_.remove(index); + onChanged(); + } else { + tasksBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public com.google.cloud.run.v2.Task.Builder getTasksBuilder(int index) { + return getTasksFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public com.google.cloud.run.v2.TaskOrBuilder getTasksOrBuilder(int index) { + if (tasksBuilder_ == null) { + return tasks_.get(index); + } else { + return tasksBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public java.util.List getTasksOrBuilderList() { + if (tasksBuilder_ != null) { + return tasksBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(tasks_); + } + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public com.google.cloud.run.v2.Task.Builder addTasksBuilder() { + return getTasksFieldBuilder().addBuilder(com.google.cloud.run.v2.Task.getDefaultInstance()); + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public com.google.cloud.run.v2.Task.Builder addTasksBuilder(int index) { + return getTasksFieldBuilder() + .addBuilder(index, com.google.cloud.run.v2.Task.getDefaultInstance()); + } + /** + * + * + *
+     * The resulting list of Tasks.
+     * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + public java.util.List getTasksBuilderList() { + return getTasksFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Task, + com.google.cloud.run.v2.Task.Builder, + com.google.cloud.run.v2.TaskOrBuilder> + getTasksFieldBuilder() { + if (tasksBuilder_ == null) { + tasksBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Task, + com.google.cloud.run.v2.Task.Builder, + com.google.cloud.run.v2.TaskOrBuilder>( + tasks_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + tasks_ = null; + } + return tasksBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A token indicating there are more items than page_size. Use it in the next
+     * ListTasks request to continue.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token indicating there are more items than page_size. Use it in the next
+     * ListTasks request to continue.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token indicating there are more items than page_size. Use it in the next
+     * ListTasks request to continue.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token indicating there are more items than page_size. Use it in the next
+     * ListTasks request to continue.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token indicating there are more items than page_size. Use it in the next
+     * ListTasks request to continue.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.ListTasksResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.ListTasksResponse) + private static final com.google.cloud.run.v2.ListTasksResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.ListTasksResponse(); + } + + public static com.google.cloud.run.v2.ListTasksResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListTasksResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.ListTasksResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksResponseOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksResponseOrBuilder.java new file mode 100644 index 000000000000..400af862b4a6 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/ListTasksResponseOrBuilder.java @@ -0,0 +1,103 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/task.proto + +package com.google.cloud.run.v2; + +public interface ListTasksResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.ListTasksResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The resulting list of Tasks.
+   * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + java.util.List getTasksList(); + /** + * + * + *
+   * The resulting list of Tasks.
+   * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + com.google.cloud.run.v2.Task getTasks(int index); + /** + * + * + *
+   * The resulting list of Tasks.
+   * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + int getTasksCount(); + /** + * + * + *
+   * The resulting list of Tasks.
+   * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + java.util.List getTasksOrBuilderList(); + /** + * + * + *
+   * The resulting list of Tasks.
+   * 
+ * + * repeated .google.cloud.run.v2.Task tasks = 1; + */ + com.google.cloud.run.v2.TaskOrBuilder getTasksOrBuilder(int index); + + /** + * + * + *
+   * A token indicating there are more items than page_size. Use it in the next
+   * ListTasks request to continue.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A token indicating there are more items than page_size. Use it in the next
+   * ListTasks request to continue.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/RunJobRequest.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/RunJobRequest.java new file mode 100644 index 000000000000..e186e174b517 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/RunJobRequest.java @@ -0,0 +1,913 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Request message to create a new Execution of a Job.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.RunJobRequest} + */ +public final class RunJobRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.RunJobRequest) + RunJobRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use RunJobRequest.newBuilder() to construct. + private RunJobRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RunJobRequest() { + name_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RunJobRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_RunJobRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_RunJobRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.RunJobRequest.class, + com.google.cloud.run.v2.RunJobRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The full name of the Job.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The full name of the Job.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 2; + private boolean validateOnly_; + /** + * + * + *
+   * Indicates that the request should be validated without actually
+   * deleting any resources.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + public static final int ETAG_FIELD_NUMBER = 3; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 3; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 3; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (validateOnly_ != false) { + output.writeBool(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, etag_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, validateOnly_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, etag_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.RunJobRequest)) { + return super.equals(obj); + } + com.google.cloud.run.v2.RunJobRequest other = (com.google.cloud.run.v2.RunJobRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.RunJobRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.RunJobRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.RunJobRequest parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.RunJobRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.RunJobRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.RunJobRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.RunJobRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.RunJobRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.RunJobRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.RunJobRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.RunJobRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.RunJobRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.RunJobRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message to create a new Execution of a Job.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.RunJobRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.RunJobRequest) + com.google.cloud.run.v2.RunJobRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_RunJobRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_RunJobRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.RunJobRequest.class, + com.google.cloud.run.v2.RunJobRequest.Builder.class); + } + + // Construct using com.google.cloud.run.v2.RunJobRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + validateOnly_ = false; + + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_RunJobRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.RunJobRequest getDefaultInstanceForType() { + return com.google.cloud.run.v2.RunJobRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.RunJobRequest build() { + com.google.cloud.run.v2.RunJobRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.RunJobRequest buildPartial() { + com.google.cloud.run.v2.RunJobRequest result = + new com.google.cloud.run.v2.RunJobRequest(this); + result.name_ = name_; + result.validateOnly_ = validateOnly_; + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.RunJobRequest) { + return mergeFrom((com.google.cloud.run.v2.RunJobRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.RunJobRequest other) { + if (other == com.google.cloud.run.v2.RunJobRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 16: + { + validateOnly_ = input.readBool(); + + break; + } // case 16 + case 26: + { + etag_ = input.readStringRequireUtf8(); + + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The full name of the Job.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The full name of the Job.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The full name of the Job.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The full name of the Job.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The full name of the Job.
+     * Format: projects/{project}/locations/{location}/jobs/{job}
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private boolean validateOnly_; + /** + * + * + *
+     * Indicates that the request should be validated without actually
+     * deleting any resources.
+     * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * Indicates that the request should be validated without actually
+     * deleting any resources.
+     * 
+ * + * bool validate_only = 2; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Indicates that the request should be validated without actually
+     * deleting any resources.
+     * 
+ * + * bool validate_only = 2; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 3; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 3; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 3; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 3; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 3; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.RunJobRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.RunJobRequest) + private static final com.google.cloud.run.v2.RunJobRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.RunJobRequest(); + } + + public static com.google.cloud.run.v2.RunJobRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RunJobRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.RunJobRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/RunJobRequestOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/RunJobRequestOrBuilder.java new file mode 100644 index 000000000000..3bd6518e5f1c --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/RunJobRequestOrBuilder.java @@ -0,0 +1,97 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +public interface RunJobRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.RunJobRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The full name of the Job.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The full name of the Job.
+   * Format: projects/{project}/locations/{location}/jobs/{job}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Indicates that the request should be validated without actually
+   * deleting any resources.
+   * 
+ * + * bool validate_only = 2; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); + + /** + * + * + *
+   * A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 3; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 3; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/Task.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/Task.java new file mode 100644 index 000000000000..9b6a2e431d07 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/Task.java @@ -0,0 +1,7417 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/task.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Task represents a single run of a container to completion.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.Task} + */ +public final class Task extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.Task) + TaskOrBuilder { + private static final long serialVersionUID = 0L; + // Use Task.newBuilder() to construct. + private Task(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Task() { + name_ = ""; + uid_ = ""; + job_ = ""; + execution_ = ""; + containers_ = java.util.Collections.emptyList(); + volumes_ = java.util.Collections.emptyList(); + serviceAccount_ = ""; + executionEnvironment_ = 0; + conditions_ = java.util.Collections.emptyList(); + encryptionKey_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Task(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.TaskProto.internal_static_google_cloud_run_v2_Task_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 4: + return internalGetLabels(); + case 5: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_Task_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.Task.class, com.google.cloud.run.v2.Task.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Output only. The unique name of this Task.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The unique name of this Task.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int UID_FIELD_NUMBER = 2; + private volatile java.lang.Object uid_; + /** + * + * + *
+   * Output only. Server assigned unique identifier for the Task. The value is a UUID4
+   * string and guaranteed to remain unchanged until the resource is deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + @java.lang.Override + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Server assigned unique identifier for the Task. The value is a UUID4
+   * string and guaranteed to remain unchanged until the resource is deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int GENERATION_FIELD_NUMBER = 3; + private long generation_; + /** + * + * + *
+   * Output only. A number that monotonically increases every time the user
+   * modifies the desired state.
+   * 
+ * + * int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The generation. + */ + @java.lang.Override + public long getGeneration() { + return generation_; + } + + public static final int LABELS_FIELD_NUMBER = 4; + + private static final class LabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_Task_LabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int ANNOTATIONS_FIELD_NUMBER = 5; + + private static final class AnnotationsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_Task_AnnotationsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int CREATE_TIME_FIELD_NUMBER = 6; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Output only. Represents time when the task was created by the job controller.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Output only. Represents time when the task was created by the job controller.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Output only. Represents time when the task was created by the job controller.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int START_TIME_FIELD_NUMBER = 27; + private com.google.protobuf.Timestamp startTime_; + /** + * + * + *
+   * Output only. Represents time when the task started to run.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the startTime field is set. + */ + @java.lang.Override + public boolean hasStartTime() { + return startTime_ != null; + } + /** + * + * + *
+   * Output only. Represents time when the task started to run.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The startTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getStartTime() { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + /** + * + * + *
+   * Output only. Represents time when the task started to run.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + return getStartTime(); + } + + public static final int COMPLETION_TIME_FIELD_NUMBER = 7; + private com.google.protobuf.Timestamp completionTime_; + /** + * + * + *
+   * Output only. Represents time when the Task was completed. It is not guaranteed to
+   * be set in happens-before order across separate operations.
+   * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the completionTime field is set. + */ + @java.lang.Override + public boolean hasCompletionTime() { + return completionTime_ != null; + } + /** + * + * + *
+   * Output only. Represents time when the Task was completed. It is not guaranteed to
+   * be set in happens-before order across separate operations.
+   * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The completionTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCompletionTime() { + return completionTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : completionTime_; + } + /** + * + * + *
+   * Output only. Represents time when the Task was completed. It is not guaranteed to
+   * be set in happens-before order across separate operations.
+   * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCompletionTimeOrBuilder() { + return getCompletionTime(); + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 8; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + public static final int DELETE_TIME_FIELD_NUMBER = 9; + private com.google.protobuf.Timestamp deleteTime_; + /** + * + * + *
+   * Output only. For a deleted resource, the deletion time. It is only
+   * populated as a response to a Delete request.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + @java.lang.Override + public boolean hasDeleteTime() { + return deleteTime_ != null; + } + /** + * + * + *
+   * Output only. For a deleted resource, the deletion time. It is only
+   * populated as a response to a Delete request.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getDeleteTime() { + return deleteTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : deleteTime_; + } + /** + * + * + *
+   * Output only. For a deleted resource, the deletion time. It is only
+   * populated as a response to a Delete request.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + return getDeleteTime(); + } + + public static final int EXPIRE_TIME_FIELD_NUMBER = 10; + private com.google.protobuf.Timestamp expireTime_; + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted. It is only populated as a response to a Delete
+   * request.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + @java.lang.Override + public boolean hasExpireTime() { + return expireTime_ != null; + } + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted. It is only populated as a response to a Delete
+   * request.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getExpireTime() { + return expireTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : expireTime_; + } + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted. It is only populated as a response to a Delete
+   * request.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + return getExpireTime(); + } + + public static final int JOB_FIELD_NUMBER = 12; + private volatile java.lang.Object job_; + /** + * + * + *
+   * Output only. The name of the parent Job.
+   * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The job. + */ + @java.lang.Override + public java.lang.String getJob() { + java.lang.Object ref = job_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + job_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The name of the parent Job.
+   * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for job. + */ + @java.lang.Override + public com.google.protobuf.ByteString getJobBytes() { + java.lang.Object ref = job_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + job_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int EXECUTION_FIELD_NUMBER = 13; + private volatile java.lang.Object execution_; + /** + * + * + *
+   * Output only. The name of the parent Execution.
+   * 
+ * + * + * string execution = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The execution. + */ + @java.lang.Override + public java.lang.String getExecution() { + java.lang.Object ref = execution_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + execution_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The name of the parent Execution.
+   * 
+ * + * + * string execution = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for execution. + */ + @java.lang.Override + public com.google.protobuf.ByteString getExecutionBytes() { + java.lang.Object ref = execution_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + execution_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONTAINERS_FIELD_NUMBER = 14; + private java.util.List containers_; + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + @java.lang.Override + public java.util.List getContainersList() { + return containers_; + } + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + @java.lang.Override + public java.util.List + getContainersOrBuilderList() { + return containers_; + } + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + @java.lang.Override + public int getContainersCount() { + return containers_.size(); + } + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + @java.lang.Override + public com.google.cloud.run.v2.Container getContainers(int index) { + return containers_.get(index); + } + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + @java.lang.Override + public com.google.cloud.run.v2.ContainerOrBuilder getContainersOrBuilder(int index) { + return containers_.get(index); + } + + public static final int VOLUMES_FIELD_NUMBER = 15; + private java.util.List volumes_; + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + @java.lang.Override + public java.util.List getVolumesList() { + return volumes_; + } + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + @java.lang.Override + public java.util.List + getVolumesOrBuilderList() { + return volumes_; + } + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + @java.lang.Override + public int getVolumesCount() { + return volumes_.size(); + } + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + @java.lang.Override + public com.google.cloud.run.v2.Volume getVolumes(int index) { + return volumes_.get(index); + } + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + @java.lang.Override + public com.google.cloud.run.v2.VolumeOrBuilder getVolumesOrBuilder(int index) { + return volumes_.get(index); + } + + public static final int MAX_RETRIES_FIELD_NUMBER = 16; + private int maxRetries_; + /** + * + * + *
+   * Number of retries allowed per Task, before marking this Task failed.
+   * 
+ * + * int32 max_retries = 16; + * + * @return The maxRetries. + */ + @java.lang.Override + public int getMaxRetries() { + return maxRetries_; + } + + public static final int TIMEOUT_FIELD_NUMBER = 17; + private com.google.protobuf.Duration timeout_; + /** + * + * + *
+   * Max allowed time duration the Task may be active before the system will
+   * actively try to mark it failed and kill associated containers. This applies
+   * per attempt of a task, meaning each retry can run for the full timeout.
+   * 
+ * + * .google.protobuf.Duration timeout = 17; + * + * @return Whether the timeout field is set. + */ + @java.lang.Override + public boolean hasTimeout() { + return timeout_ != null; + } + /** + * + * + *
+   * Max allowed time duration the Task may be active before the system will
+   * actively try to mark it failed and kill associated containers. This applies
+   * per attempt of a task, meaning each retry can run for the full timeout.
+   * 
+ * + * .google.protobuf.Duration timeout = 17; + * + * @return The timeout. + */ + @java.lang.Override + public com.google.protobuf.Duration getTimeout() { + return timeout_ == null ? com.google.protobuf.Duration.getDefaultInstance() : timeout_; + } + /** + * + * + *
+   * Max allowed time duration the Task may be active before the system will
+   * actively try to mark it failed and kill associated containers. This applies
+   * per attempt of a task, meaning each retry can run for the full timeout.
+   * 
+ * + * .google.protobuf.Duration timeout = 17; + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getTimeoutOrBuilder() { + return getTimeout(); + } + + public static final int SERVICE_ACCOUNT_FIELD_NUMBER = 18; + private volatile java.lang.Object serviceAccount_; + /** + * + * + *
+   * Email address of the IAM service account associated with the Task of a
+   * Job. The service account represents the identity of the
+   * running task, and determines what permissions the task has. If
+   * not provided, the task will use the project's default service account.
+   * 
+ * + * string service_account = 18; + * + * @return The serviceAccount. + */ + @java.lang.Override + public java.lang.String getServiceAccount() { + java.lang.Object ref = serviceAccount_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceAccount_ = s; + return s; + } + } + /** + * + * + *
+   * Email address of the IAM service account associated with the Task of a
+   * Job. The service account represents the identity of the
+   * running task, and determines what permissions the task has. If
+   * not provided, the task will use the project's default service account.
+   * 
+ * + * string service_account = 18; + * + * @return The bytes for serviceAccount. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServiceAccountBytes() { + java.lang.Object ref = serviceAccount_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceAccount_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int EXECUTION_ENVIRONMENT_FIELD_NUMBER = 20; + private int executionEnvironment_; + /** + * + * + *
+   * The execution environment being used to host this Task.
+   * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 20; + * + * @return The enum numeric value on the wire for executionEnvironment. + */ + @java.lang.Override + public int getExecutionEnvironmentValue() { + return executionEnvironment_; + } + /** + * + * + *
+   * The execution environment being used to host this Task.
+   * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 20; + * + * @return The executionEnvironment. + */ + @java.lang.Override + public com.google.cloud.run.v2.ExecutionEnvironment getExecutionEnvironment() { + @SuppressWarnings("deprecation") + com.google.cloud.run.v2.ExecutionEnvironment result = + com.google.cloud.run.v2.ExecutionEnvironment.valueOf(executionEnvironment_); + return result == null ? com.google.cloud.run.v2.ExecutionEnvironment.UNRECOGNIZED : result; + } + + public static final int RECONCILING_FIELD_NUMBER = 21; + private boolean reconciling_; + /** + * + * + *
+   * Output only. Indicates whether the resource's reconciliation is still in progress.
+   * See comments in `Job.reconciling` for additional information on
+   * reconciliation process in Cloud Run.
+   * 
+ * + * bool reconciling = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + @java.lang.Override + public boolean getReconciling() { + return reconciling_; + } + + public static final int CONDITIONS_FIELD_NUMBER = 22; + private java.util.List conditions_; + /** + * + * + *
+   * Output only. The Condition of this Task, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.List getConditionsList() { + return conditions_; + } + /** + * + * + *
+   * Output only. The Condition of this Task, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.List + getConditionsOrBuilderList() { + return conditions_; + } + /** + * + * + *
+   * Output only. The Condition of this Task, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public int getConditionsCount() { + return conditions_.size(); + } + /** + * + * + *
+   * Output only. The Condition of this Task, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.run.v2.Condition getConditions(int index) { + return conditions_.get(index); + } + /** + * + * + *
+   * Output only. The Condition of this Task, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.run.v2.ConditionOrBuilder getConditionsOrBuilder(int index) { + return conditions_.get(index); + } + + public static final int OBSERVED_GENERATION_FIELD_NUMBER = 23; + private long observedGeneration_; + /** + * + * + *
+   * Output only. The generation of this Task. See comments in `Job.reconciling`
+   * for additional information on reconciliation process in Cloud Run.
+   * 
+ * + * int64 observed_generation = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The observedGeneration. + */ + @java.lang.Override + public long getObservedGeneration() { + return observedGeneration_; + } + + public static final int INDEX_FIELD_NUMBER = 24; + private int index_; + /** + * + * + *
+   * Output only. Index of the Task, unique per execution, and beginning at 0.
+   * 
+ * + * int32 index = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The index. + */ + @java.lang.Override + public int getIndex() { + return index_; + } + + public static final int RETRIED_FIELD_NUMBER = 25; + private int retried_; + /** + * + * + *
+   * Output only. The number of times this Task was retried.
+   * Tasks are retried when they fail up to the maxRetries limit.
+   * 
+ * + * int32 retried = 25 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The retried. + */ + @java.lang.Override + public int getRetried() { + return retried_; + } + + public static final int LAST_ATTEMPT_RESULT_FIELD_NUMBER = 26; + private com.google.cloud.run.v2.TaskAttemptResult lastAttemptResult_; + /** + * + * + *
+   * Output only. Result of the last attempt of this Task.
+   * 
+ * + * + * .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the lastAttemptResult field is set. + */ + @java.lang.Override + public boolean hasLastAttemptResult() { + return lastAttemptResult_ != null; + } + /** + * + * + *
+   * Output only. Result of the last attempt of this Task.
+   * 
+ * + * + * .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastAttemptResult. + */ + @java.lang.Override + public com.google.cloud.run.v2.TaskAttemptResult getLastAttemptResult() { + return lastAttemptResult_ == null + ? com.google.cloud.run.v2.TaskAttemptResult.getDefaultInstance() + : lastAttemptResult_; + } + /** + * + * + *
+   * Output only. Result of the last attempt of this Task.
+   * 
+ * + * + * .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.run.v2.TaskAttemptResultOrBuilder getLastAttemptResultOrBuilder() { + return getLastAttemptResult(); + } + + public static final int ENCRYPTION_KEY_FIELD_NUMBER = 28; + private volatile java.lang.Object encryptionKey_; + /** + * + * + *
+   * Output only. A reference to a customer managed encryption key (CMEK) to use to encrypt
+   * this container image. For more information, go to
+   * https://cloud.google.com/run/docs/securing/using-cmek
+   * 
+ * + * + * string encryption_key = 28 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The encryptionKey. + */ + @java.lang.Override + public java.lang.String getEncryptionKey() { + java.lang.Object ref = encryptionKey_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + encryptionKey_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. A reference to a customer managed encryption key (CMEK) to use to encrypt
+   * this container image. For more information, go to
+   * https://cloud.google.com/run/docs/securing/using-cmek
+   * 
+ * + * + * string encryption_key = 28 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for encryptionKey. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEncryptionKeyBytes() { + java.lang.Object ref = encryptionKey_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + encryptionKey_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VPC_ACCESS_FIELD_NUMBER = 29; + private com.google.cloud.run.v2.VpcAccess vpcAccess_; + /** + * + * + *
+   * Output only. VPC Access configuration to use for this Task. For more information,
+   * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+   * 
+ * + * + * .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the vpcAccess field is set. + */ + @java.lang.Override + public boolean hasVpcAccess() { + return vpcAccess_ != null; + } + /** + * + * + *
+   * Output only. VPC Access configuration to use for this Task. For more information,
+   * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+   * 
+ * + * + * .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The vpcAccess. + */ + @java.lang.Override + public com.google.cloud.run.v2.VpcAccess getVpcAccess() { + return vpcAccess_ == null ? com.google.cloud.run.v2.VpcAccess.getDefaultInstance() : vpcAccess_; + } + /** + * + * + *
+   * Output only. VPC Access configuration to use for this Task. For more information,
+   * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+   * 
+ * + * + * .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.run.v2.VpcAccessOrBuilder getVpcAccessOrBuilder() { + return getVpcAccess(); + } + + public static final int ETAG_FIELD_NUMBER = 99; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * Output only. A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uid_); + } + if (generation_ != 0L) { + output.writeInt64(3, generation_); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 4); + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetAnnotations(), AnnotationsDefaultEntryHolder.defaultEntry, 5); + if (createTime_ != null) { + output.writeMessage(6, getCreateTime()); + } + if (completionTime_ != null) { + output.writeMessage(7, getCompletionTime()); + } + if (updateTime_ != null) { + output.writeMessage(8, getUpdateTime()); + } + if (deleteTime_ != null) { + output.writeMessage(9, getDeleteTime()); + } + if (expireTime_ != null) { + output.writeMessage(10, getExpireTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(job_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 12, job_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(execution_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 13, execution_); + } + for (int i = 0; i < containers_.size(); i++) { + output.writeMessage(14, containers_.get(i)); + } + for (int i = 0; i < volumes_.size(); i++) { + output.writeMessage(15, volumes_.get(i)); + } + if (maxRetries_ != 0) { + output.writeInt32(16, maxRetries_); + } + if (timeout_ != null) { + output.writeMessage(17, getTimeout()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceAccount_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 18, serviceAccount_); + } + if (executionEnvironment_ + != com.google.cloud.run.v2.ExecutionEnvironment.EXECUTION_ENVIRONMENT_UNSPECIFIED + .getNumber()) { + output.writeEnum(20, executionEnvironment_); + } + if (reconciling_ != false) { + output.writeBool(21, reconciling_); + } + for (int i = 0; i < conditions_.size(); i++) { + output.writeMessage(22, conditions_.get(i)); + } + if (observedGeneration_ != 0L) { + output.writeInt64(23, observedGeneration_); + } + if (index_ != 0) { + output.writeInt32(24, index_); + } + if (retried_ != 0) { + output.writeInt32(25, retried_); + } + if (lastAttemptResult_ != null) { + output.writeMessage(26, getLastAttemptResult()); + } + if (startTime_ != null) { + output.writeMessage(27, getStartTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(encryptionKey_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 28, encryptionKey_); + } + if (vpcAccess_ != null) { + output.writeMessage(29, getVpcAccess()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 99, etag_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uid_); + } + if (generation_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, generation_); + } + for (java.util.Map.Entry entry : + internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry labels__ = + LabelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, labels__); + } + for (java.util.Map.Entry entry : + internalGetAnnotations().getMap().entrySet()) { + com.google.protobuf.MapEntry annotations__ = + AnnotationsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, annotations__); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getCreateTime()); + } + if (completionTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getCompletionTime()); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getUpdateTime()); + } + if (deleteTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getDeleteTime()); + } + if (expireTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(10, getExpireTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(job_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(12, job_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(execution_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(13, execution_); + } + for (int i = 0; i < containers_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(14, containers_.get(i)); + } + for (int i = 0; i < volumes_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(15, volumes_.get(i)); + } + if (maxRetries_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(16, maxRetries_); + } + if (timeout_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(17, getTimeout()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceAccount_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(18, serviceAccount_); + } + if (executionEnvironment_ + != com.google.cloud.run.v2.ExecutionEnvironment.EXECUTION_ENVIRONMENT_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(20, executionEnvironment_); + } + if (reconciling_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(21, reconciling_); + } + for (int i = 0; i < conditions_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(22, conditions_.get(i)); + } + if (observedGeneration_ != 0L) { + size += com.google.protobuf.CodedOutputStream.computeInt64Size(23, observedGeneration_); + } + if (index_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(24, index_); + } + if (retried_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(25, retried_); + } + if (lastAttemptResult_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(26, getLastAttemptResult()); + } + if (startTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(27, getStartTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(encryptionKey_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(28, encryptionKey_); + } + if (vpcAccess_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(29, getVpcAccess()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(99, etag_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.Task)) { + return super.equals(obj); + } + com.google.cloud.run.v2.Task other = (com.google.cloud.run.v2.Task) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUid().equals(other.getUid())) return false; + if (getGeneration() != other.getGeneration()) return false; + if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (!internalGetAnnotations().equals(other.internalGetAnnotations())) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasStartTime() != other.hasStartTime()) return false; + if (hasStartTime()) { + if (!getStartTime().equals(other.getStartTime())) return false; + } + if (hasCompletionTime() != other.hasCompletionTime()) return false; + if (hasCompletionTime()) { + if (!getCompletionTime().equals(other.getCompletionTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (hasDeleteTime() != other.hasDeleteTime()) return false; + if (hasDeleteTime()) { + if (!getDeleteTime().equals(other.getDeleteTime())) return false; + } + if (hasExpireTime() != other.hasExpireTime()) return false; + if (hasExpireTime()) { + if (!getExpireTime().equals(other.getExpireTime())) return false; + } + if (!getJob().equals(other.getJob())) return false; + if (!getExecution().equals(other.getExecution())) return false; + if (!getContainersList().equals(other.getContainersList())) return false; + if (!getVolumesList().equals(other.getVolumesList())) return false; + if (getMaxRetries() != other.getMaxRetries()) return false; + if (hasTimeout() != other.hasTimeout()) return false; + if (hasTimeout()) { + if (!getTimeout().equals(other.getTimeout())) return false; + } + if (!getServiceAccount().equals(other.getServiceAccount())) return false; + if (executionEnvironment_ != other.executionEnvironment_) return false; + if (getReconciling() != other.getReconciling()) return false; + if (!getConditionsList().equals(other.getConditionsList())) return false; + if (getObservedGeneration() != other.getObservedGeneration()) return false; + if (getIndex() != other.getIndex()) return false; + if (getRetried() != other.getRetried()) return false; + if (hasLastAttemptResult() != other.hasLastAttemptResult()) return false; + if (hasLastAttemptResult()) { + if (!getLastAttemptResult().equals(other.getLastAttemptResult())) return false; + } + if (!getEncryptionKey().equals(other.getEncryptionKey())) return false; + if (hasVpcAccess() != other.hasVpcAccess()) return false; + if (hasVpcAccess()) { + if (!getVpcAccess().equals(other.getVpcAccess())) return false; + } + if (!getEtag().equals(other.getEtag())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + UID_FIELD_NUMBER; + hash = (53 * hash) + getUid().hashCode(); + hash = (37 * hash) + GENERATION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getGeneration()); + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + if (!internalGetAnnotations().getMap().isEmpty()) { + hash = (37 * hash) + ANNOTATIONS_FIELD_NUMBER; + hash = (53 * hash) + internalGetAnnotations().hashCode(); + } + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasStartTime()) { + hash = (37 * hash) + START_TIME_FIELD_NUMBER; + hash = (53 * hash) + getStartTime().hashCode(); + } + if (hasCompletionTime()) { + hash = (37 * hash) + COMPLETION_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCompletionTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + if (hasDeleteTime()) { + hash = (37 * hash) + DELETE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getDeleteTime().hashCode(); + } + if (hasExpireTime()) { + hash = (37 * hash) + EXPIRE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getExpireTime().hashCode(); + } + hash = (37 * hash) + JOB_FIELD_NUMBER; + hash = (53 * hash) + getJob().hashCode(); + hash = (37 * hash) + EXECUTION_FIELD_NUMBER; + hash = (53 * hash) + getExecution().hashCode(); + if (getContainersCount() > 0) { + hash = (37 * hash) + CONTAINERS_FIELD_NUMBER; + hash = (53 * hash) + getContainersList().hashCode(); + } + if (getVolumesCount() > 0) { + hash = (37 * hash) + VOLUMES_FIELD_NUMBER; + hash = (53 * hash) + getVolumesList().hashCode(); + } + hash = (37 * hash) + MAX_RETRIES_FIELD_NUMBER; + hash = (53 * hash) + getMaxRetries(); + if (hasTimeout()) { + hash = (37 * hash) + TIMEOUT_FIELD_NUMBER; + hash = (53 * hash) + getTimeout().hashCode(); + } + hash = (37 * hash) + SERVICE_ACCOUNT_FIELD_NUMBER; + hash = (53 * hash) + getServiceAccount().hashCode(); + hash = (37 * hash) + EXECUTION_ENVIRONMENT_FIELD_NUMBER; + hash = (53 * hash) + executionEnvironment_; + hash = (37 * hash) + RECONCILING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getReconciling()); + if (getConditionsCount() > 0) { + hash = (37 * hash) + CONDITIONS_FIELD_NUMBER; + hash = (53 * hash) + getConditionsList().hashCode(); + } + hash = (37 * hash) + OBSERVED_GENERATION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getObservedGeneration()); + hash = (37 * hash) + INDEX_FIELD_NUMBER; + hash = (53 * hash) + getIndex(); + hash = (37 * hash) + RETRIED_FIELD_NUMBER; + hash = (53 * hash) + getRetried(); + if (hasLastAttemptResult()) { + hash = (37 * hash) + LAST_ATTEMPT_RESULT_FIELD_NUMBER; + hash = (53 * hash) + getLastAttemptResult().hashCode(); + } + hash = (37 * hash) + ENCRYPTION_KEY_FIELD_NUMBER; + hash = (53 * hash) + getEncryptionKey().hashCode(); + if (hasVpcAccess()) { + hash = (37 * hash) + VPC_ACCESS_FIELD_NUMBER; + hash = (53 * hash) + getVpcAccess().hashCode(); + } + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.Task parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.Task parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.Task parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.Task parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.Task parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.Task parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.Task parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.Task parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.Task parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.Task parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.Task parseFrom(com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.Task parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.Task prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Task represents a single run of a container to completion.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.Task} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.Task) + com.google.cloud.run.v2.TaskOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.TaskProto.internal_static_google_cloud_run_v2_Task_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 4: + return internalGetLabels(); + case 5: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 4: + return internalGetMutableLabels(); + case 5: + return internalGetMutableAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_Task_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.Task.class, com.google.cloud.run.v2.Task.Builder.class); + } + + // Construct using com.google.cloud.run.v2.Task.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + uid_ = ""; + + generation_ = 0L; + + internalGetMutableLabels().clear(); + internalGetMutableAnnotations().clear(); + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (startTimeBuilder_ == null) { + startTime_ = null; + } else { + startTime_ = null; + startTimeBuilder_ = null; + } + if (completionTimeBuilder_ == null) { + completionTime_ = null; + } else { + completionTime_ = null; + completionTimeBuilder_ = null; + } + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + if (expireTimeBuilder_ == null) { + expireTime_ = null; + } else { + expireTime_ = null; + expireTimeBuilder_ = null; + } + job_ = ""; + + execution_ = ""; + + if (containersBuilder_ == null) { + containers_ = java.util.Collections.emptyList(); + } else { + containers_ = null; + containersBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + if (volumesBuilder_ == null) { + volumes_ = java.util.Collections.emptyList(); + } else { + volumes_ = null; + volumesBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + maxRetries_ = 0; + + if (timeoutBuilder_ == null) { + timeout_ = null; + } else { + timeout_ = null; + timeoutBuilder_ = null; + } + serviceAccount_ = ""; + + executionEnvironment_ = 0; + + reconciling_ = false; + + if (conditionsBuilder_ == null) { + conditions_ = java.util.Collections.emptyList(); + } else { + conditions_ = null; + conditionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000010); + observedGeneration_ = 0L; + + index_ = 0; + + retried_ = 0; + + if (lastAttemptResultBuilder_ == null) { + lastAttemptResult_ = null; + } else { + lastAttemptResult_ = null; + lastAttemptResultBuilder_ = null; + } + encryptionKey_ = ""; + + if (vpcAccessBuilder_ == null) { + vpcAccess_ = null; + } else { + vpcAccess_ = null; + vpcAccessBuilder_ = null; + } + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.TaskProto.internal_static_google_cloud_run_v2_Task_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.Task getDefaultInstanceForType() { + return com.google.cloud.run.v2.Task.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.Task build() { + com.google.cloud.run.v2.Task result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.Task buildPartial() { + com.google.cloud.run.v2.Task result = new com.google.cloud.run.v2.Task(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.uid_ = uid_; + result.generation_ = generation_; + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + result.annotations_ = internalGetAnnotations(); + result.annotations_.makeImmutable(); + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (startTimeBuilder_ == null) { + result.startTime_ = startTime_; + } else { + result.startTime_ = startTimeBuilder_.build(); + } + if (completionTimeBuilder_ == null) { + result.completionTime_ = completionTime_; + } else { + result.completionTime_ = completionTimeBuilder_.build(); + } + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + if (deleteTimeBuilder_ == null) { + result.deleteTime_ = deleteTime_; + } else { + result.deleteTime_ = deleteTimeBuilder_.build(); + } + if (expireTimeBuilder_ == null) { + result.expireTime_ = expireTime_; + } else { + result.expireTime_ = expireTimeBuilder_.build(); + } + result.job_ = job_; + result.execution_ = execution_; + if (containersBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0)) { + containers_ = java.util.Collections.unmodifiableList(containers_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.containers_ = containers_; + } else { + result.containers_ = containersBuilder_.build(); + } + if (volumesBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0)) { + volumes_ = java.util.Collections.unmodifiableList(volumes_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.volumes_ = volumes_; + } else { + result.volumes_ = volumesBuilder_.build(); + } + result.maxRetries_ = maxRetries_; + if (timeoutBuilder_ == null) { + result.timeout_ = timeout_; + } else { + result.timeout_ = timeoutBuilder_.build(); + } + result.serviceAccount_ = serviceAccount_; + result.executionEnvironment_ = executionEnvironment_; + result.reconciling_ = reconciling_; + if (conditionsBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0)) { + conditions_ = java.util.Collections.unmodifiableList(conditions_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.conditions_ = conditions_; + } else { + result.conditions_ = conditionsBuilder_.build(); + } + result.observedGeneration_ = observedGeneration_; + result.index_ = index_; + result.retried_ = retried_; + if (lastAttemptResultBuilder_ == null) { + result.lastAttemptResult_ = lastAttemptResult_; + } else { + result.lastAttemptResult_ = lastAttemptResultBuilder_.build(); + } + result.encryptionKey_ = encryptionKey_; + if (vpcAccessBuilder_ == null) { + result.vpcAccess_ = vpcAccess_; + } else { + result.vpcAccess_ = vpcAccessBuilder_.build(); + } + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.Task) { + return mergeFrom((com.google.cloud.run.v2.Task) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.Task other) { + if (other == com.google.cloud.run.v2.Task.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getUid().isEmpty()) { + uid_ = other.uid_; + onChanged(); + } + if (other.getGeneration() != 0L) { + setGeneration(other.getGeneration()); + } + internalGetMutableLabels().mergeFrom(other.internalGetLabels()); + internalGetMutableAnnotations().mergeFrom(other.internalGetAnnotations()); + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasStartTime()) { + mergeStartTime(other.getStartTime()); + } + if (other.hasCompletionTime()) { + mergeCompletionTime(other.getCompletionTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + if (other.hasDeleteTime()) { + mergeDeleteTime(other.getDeleteTime()); + } + if (other.hasExpireTime()) { + mergeExpireTime(other.getExpireTime()); + } + if (!other.getJob().isEmpty()) { + job_ = other.job_; + onChanged(); + } + if (!other.getExecution().isEmpty()) { + execution_ = other.execution_; + onChanged(); + } + if (containersBuilder_ == null) { + if (!other.containers_.isEmpty()) { + if (containers_.isEmpty()) { + containers_ = other.containers_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureContainersIsMutable(); + containers_.addAll(other.containers_); + } + onChanged(); + } + } else { + if (!other.containers_.isEmpty()) { + if (containersBuilder_.isEmpty()) { + containersBuilder_.dispose(); + containersBuilder_ = null; + containers_ = other.containers_; + bitField0_ = (bitField0_ & ~0x00000004); + containersBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getContainersFieldBuilder() + : null; + } else { + containersBuilder_.addAllMessages(other.containers_); + } + } + } + if (volumesBuilder_ == null) { + if (!other.volumes_.isEmpty()) { + if (volumes_.isEmpty()) { + volumes_ = other.volumes_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureVolumesIsMutable(); + volumes_.addAll(other.volumes_); + } + onChanged(); + } + } else { + if (!other.volumes_.isEmpty()) { + if (volumesBuilder_.isEmpty()) { + volumesBuilder_.dispose(); + volumesBuilder_ = null; + volumes_ = other.volumes_; + bitField0_ = (bitField0_ & ~0x00000008); + volumesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getVolumesFieldBuilder() + : null; + } else { + volumesBuilder_.addAllMessages(other.volumes_); + } + } + } + if (other.getMaxRetries() != 0) { + setMaxRetries(other.getMaxRetries()); + } + if (other.hasTimeout()) { + mergeTimeout(other.getTimeout()); + } + if (!other.getServiceAccount().isEmpty()) { + serviceAccount_ = other.serviceAccount_; + onChanged(); + } + if (other.executionEnvironment_ != 0) { + setExecutionEnvironmentValue(other.getExecutionEnvironmentValue()); + } + if (other.getReconciling() != false) { + setReconciling(other.getReconciling()); + } + if (conditionsBuilder_ == null) { + if (!other.conditions_.isEmpty()) { + if (conditions_.isEmpty()) { + conditions_ = other.conditions_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureConditionsIsMutable(); + conditions_.addAll(other.conditions_); + } + onChanged(); + } + } else { + if (!other.conditions_.isEmpty()) { + if (conditionsBuilder_.isEmpty()) { + conditionsBuilder_.dispose(); + conditionsBuilder_ = null; + conditions_ = other.conditions_; + bitField0_ = (bitField0_ & ~0x00000010); + conditionsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getConditionsFieldBuilder() + : null; + } else { + conditionsBuilder_.addAllMessages(other.conditions_); + } + } + } + if (other.getObservedGeneration() != 0L) { + setObservedGeneration(other.getObservedGeneration()); + } + if (other.getIndex() != 0) { + setIndex(other.getIndex()); + } + if (other.getRetried() != 0) { + setRetried(other.getRetried()); + } + if (other.hasLastAttemptResult()) { + mergeLastAttemptResult(other.getLastAttemptResult()); + } + if (!other.getEncryptionKey().isEmpty()) { + encryptionKey_ = other.encryptionKey_; + onChanged(); + } + if (other.hasVpcAccess()) { + mergeVpcAccess(other.getVpcAccess()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + uid_ = input.readStringRequireUtf8(); + + break; + } // case 18 + case 24: + { + generation_ = input.readInt64(); + + break; + } // case 24 + case 34: + { + com.google.protobuf.MapEntry labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableLabels() + .getMutableMap() + .put(labels__.getKey(), labels__.getValue()); + break; + } // case 34 + case 42: + { + com.google.protobuf.MapEntry annotations__ = + input.readMessage( + AnnotationsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableAnnotations() + .getMutableMap() + .put(annotations__.getKey(), annotations__.getValue()); + break; + } // case 42 + case 50: + { + input.readMessage(getCreateTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 50 + case 58: + { + input.readMessage(getCompletionTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 58 + case 66: + { + input.readMessage(getUpdateTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 66 + case 74: + { + input.readMessage(getDeleteTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 74 + case 82: + { + input.readMessage(getExpireTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 82 + case 98: + { + job_ = input.readStringRequireUtf8(); + + break; + } // case 98 + case 106: + { + execution_ = input.readStringRequireUtf8(); + + break; + } // case 106 + case 114: + { + com.google.cloud.run.v2.Container m = + input.readMessage( + com.google.cloud.run.v2.Container.parser(), extensionRegistry); + if (containersBuilder_ == null) { + ensureContainersIsMutable(); + containers_.add(m); + } else { + containersBuilder_.addMessage(m); + } + break; + } // case 114 + case 122: + { + com.google.cloud.run.v2.Volume m = + input.readMessage(com.google.cloud.run.v2.Volume.parser(), extensionRegistry); + if (volumesBuilder_ == null) { + ensureVolumesIsMutable(); + volumes_.add(m); + } else { + volumesBuilder_.addMessage(m); + } + break; + } // case 122 + case 128: + { + maxRetries_ = input.readInt32(); + + break; + } // case 128 + case 138: + { + input.readMessage(getTimeoutFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 138 + case 146: + { + serviceAccount_ = input.readStringRequireUtf8(); + + break; + } // case 146 + case 160: + { + executionEnvironment_ = input.readEnum(); + + break; + } // case 160 + case 168: + { + reconciling_ = input.readBool(); + + break; + } // case 168 + case 178: + { + com.google.cloud.run.v2.Condition m = + input.readMessage( + com.google.cloud.run.v2.Condition.parser(), extensionRegistry); + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + conditions_.add(m); + } else { + conditionsBuilder_.addMessage(m); + } + break; + } // case 178 + case 184: + { + observedGeneration_ = input.readInt64(); + + break; + } // case 184 + case 192: + { + index_ = input.readInt32(); + + break; + } // case 192 + case 200: + { + retried_ = input.readInt32(); + + break; + } // case 200 + case 210: + { + input.readMessage( + getLastAttemptResultFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 210 + case 218: + { + input.readMessage(getStartTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 218 + case 226: + { + encryptionKey_ = input.readStringRequireUtf8(); + + break; + } // case 226 + case 234: + { + input.readMessage(getVpcAccessFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 234 + case 794: + { + etag_ = input.readStringRequireUtf8(); + + break; + } // case 794 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Output only. The unique name of this Task.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The unique name of this Task.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The unique name of this Task.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The unique name of this Task.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The unique name of this Task.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object uid_ = ""; + /** + * + * + *
+     * Output only. Server assigned unique identifier for the Task. The value is a UUID4
+     * string and guaranteed to remain unchanged until the resource is deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the Task. The value is a UUID4
+     * string and guaranteed to remain unchanged until the resource is deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the Task. The value is a UUID4
+     * string and guaranteed to remain unchanged until the resource is deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The uid to set. + * @return This builder for chaining. + */ + public Builder setUid(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uid_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the Task. The value is a UUID4
+     * string and guaranteed to remain unchanged until the resource is deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearUid() { + + uid_ = getDefaultInstance().getUid(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the Task. The value is a UUID4
+     * string and guaranteed to remain unchanged until the resource is deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for uid to set. + * @return This builder for chaining. + */ + public Builder setUidBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uid_ = value; + onChanged(); + return this; + } + + private long generation_; + /** + * + * + *
+     * Output only. A number that monotonically increases every time the user
+     * modifies the desired state.
+     * 
+ * + * int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The generation. + */ + @java.lang.Override + public long getGeneration() { + return generation_; + } + /** + * + * + *
+     * Output only. A number that monotonically increases every time the user
+     * modifies the desired state.
+     * 
+ * + * int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The generation to set. + * @return This builder for chaining. + */ + public Builder setGeneration(long value) { + + generation_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. A number that monotonically increases every time the user
+     * modifies the desired state.
+     * 
+ * + * int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearGeneration() { + + generation_ = 0L; + onChanged(); + return this; + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + private com.google.protobuf.MapField + internalGetMutableLabels() { + onChanged(); + ; + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.lang.String getLabelsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearLabels() { + internalGetMutableLabels().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + public Builder removeLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableLabels().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableLabels() { + return internalGetMutableLabels().getMutableMap(); + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + public Builder putLabels(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableLabels().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * KRM-style labels for the resource.
+     * User-provided labels are shared with Google's billing system, so they can
+     * be used to filter, or break down billing charges by team, component,
+     * environment, state, etc. For more information, visit
+     * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+     * https://cloud.google.com/run/docs/configuring/labels
+     * Cloud Run will populate some labels with 'run.googleapis.com' or
+     * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+     * changes will not be preserved.
+     * 
+ * + * map<string, string> labels = 4; + */ + public Builder putAllLabels(java.util.Map values) { + internalGetMutableLabels().getMutableMap().putAll(values); + return this; + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + private com.google.protobuf.MapField + internalGetMutableAnnotations() { + onChanged(); + ; + if (annotations_ == null) { + annotations_ = + com.google.protobuf.MapField.newMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + if (!annotations_.isMutable()) { + annotations_ = annotations_.copy(); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 5; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearAnnotations() { + internalGetMutableAnnotations().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 5; + */ + public Builder removeAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableAnnotations().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableAnnotations() { + return internalGetMutableAnnotations().getMutableMap(); + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 5; + */ + public Builder putAnnotations(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableAnnotations().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * KRM-style annotations for the resource.
+     * 
+ * + * map<string, string> annotations = 5; + */ + public Builder putAllAnnotations(java.util.Map values) { + internalGetMutableAnnotations().getMutableMap().putAll(values); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Output only. Represents time when the task was created by the job controller.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * Output only. Represents time when the task was created by the job controller.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Represents time when the task was created by the job controller.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the task was created by the job controller.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the task was created by the job controller.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the task was created by the job controller.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the task was created by the job controller.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Represents time when the task was created by the job controller.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Output only. Represents time when the task was created by the job controller.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp startTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + startTimeBuilder_; + /** + * + * + *
+     * Output only. Represents time when the task started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the startTime field is set. + */ + public boolean hasStartTime() { + return startTimeBuilder_ != null || startTime_ != null; + } + /** + * + * + *
+     * Output only. Represents time when the task started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The startTime. + */ + public com.google.protobuf.Timestamp getStartTime() { + if (startTimeBuilder_ == null) { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } else { + return startTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Represents time when the task started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + startTime_ = value; + onChanged(); + } else { + startTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the task started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setStartTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (startTimeBuilder_ == null) { + startTime_ = builderForValue.build(); + onChanged(); + } else { + startTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the task started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (startTime_ != null) { + startTime_ = + com.google.protobuf.Timestamp.newBuilder(startTime_).mergeFrom(value).buildPartial(); + } else { + startTime_ = value; + } + onChanged(); + } else { + startTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the task started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearStartTime() { + if (startTimeBuilder_ == null) { + startTime_ = null; + onChanged(); + } else { + startTime_ = null; + startTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the task started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getStartTimeBuilder() { + + onChanged(); + return getStartTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Represents time when the task started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + if (startTimeBuilder_ != null) { + return startTimeBuilder_.getMessageOrBuilder(); + } else { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + } + /** + * + * + *
+     * Output only. Represents time when the task started to run.
+     * It is not guaranteed to be set in happens-before order across separate
+     * operations.
+     * 
+ * + * + * .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getStartTimeFieldBuilder() { + if (startTimeBuilder_ == null) { + startTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getStartTime(), getParentForChildren(), isClean()); + startTime_ = null; + } + return startTimeBuilder_; + } + + private com.google.protobuf.Timestamp completionTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + completionTimeBuilder_; + /** + * + * + *
+     * Output only. Represents time when the Task was completed. It is not guaranteed to
+     * be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the completionTime field is set. + */ + public boolean hasCompletionTime() { + return completionTimeBuilder_ != null || completionTime_ != null; + } + /** + * + * + *
+     * Output only. Represents time when the Task was completed. It is not guaranteed to
+     * be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The completionTime. + */ + public com.google.protobuf.Timestamp getCompletionTime() { + if (completionTimeBuilder_ == null) { + return completionTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : completionTime_; + } else { + return completionTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Represents time when the Task was completed. It is not guaranteed to
+     * be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCompletionTime(com.google.protobuf.Timestamp value) { + if (completionTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + completionTime_ = value; + onChanged(); + } else { + completionTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the Task was completed. It is not guaranteed to
+     * be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCompletionTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (completionTimeBuilder_ == null) { + completionTime_ = builderForValue.build(); + onChanged(); + } else { + completionTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the Task was completed. It is not guaranteed to
+     * be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCompletionTime(com.google.protobuf.Timestamp value) { + if (completionTimeBuilder_ == null) { + if (completionTime_ != null) { + completionTime_ = + com.google.protobuf.Timestamp.newBuilder(completionTime_) + .mergeFrom(value) + .buildPartial(); + } else { + completionTime_ = value; + } + onChanged(); + } else { + completionTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the Task was completed. It is not guaranteed to
+     * be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCompletionTime() { + if (completionTimeBuilder_ == null) { + completionTime_ = null; + onChanged(); + } else { + completionTime_ = null; + completionTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. Represents time when the Task was completed. It is not guaranteed to
+     * be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCompletionTimeBuilder() { + + onChanged(); + return getCompletionTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Represents time when the Task was completed. It is not guaranteed to
+     * be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCompletionTimeOrBuilder() { + if (completionTimeBuilder_ != null) { + return completionTimeBuilder_.getMessageOrBuilder(); + } else { + return completionTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : completionTime_; + } + } + /** + * + * + *
+     * Output only. Represents time when the Task was completed. It is not guaranteed to
+     * be set in happens-before order across separate operations.
+     * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCompletionTimeFieldBuilder() { + if (completionTimeBuilder_ == null) { + completionTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCompletionTime(), getParentForChildren(), isClean()); + completionTime_ = null; + } + return completionTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private com.google.protobuf.Timestamp deleteTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + deleteTimeBuilder_; + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + public boolean hasDeleteTime() { + return deleteTimeBuilder_ != null || deleteTime_ != null; + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + public com.google.protobuf.Timestamp getDeleteTime() { + if (deleteTimeBuilder_ == null) { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } else { + return deleteTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + deleteTime_ = value; + onChanged(); + } else { + deleteTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (deleteTimeBuilder_ == null) { + deleteTime_ = builderForValue.build(); + onChanged(); + } else { + deleteTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (deleteTime_ != null) { + deleteTime_ = + com.google.protobuf.Timestamp.newBuilder(deleteTime_).mergeFrom(value).buildPartial(); + } else { + deleteTime_ = value; + } + onChanged(); + } else { + deleteTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearDeleteTime() { + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + onChanged(); + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getDeleteTimeBuilder() { + + onChanged(); + return getDeleteTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + if (deleteTimeBuilder_ != null) { + return deleteTimeBuilder_.getMessageOrBuilder(); + } else { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } + } + /** + * + * + *
+     * Output only. For a deleted resource, the deletion time. It is only
+     * populated as a response to a Delete request.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getDeleteTimeFieldBuilder() { + if (deleteTimeBuilder_ == null) { + deleteTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getDeleteTime(), getParentForChildren(), isClean()); + deleteTime_ = null; + } + return deleteTimeBuilder_; + } + + private com.google.protobuf.Timestamp expireTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + expireTimeBuilder_; + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + public boolean hasExpireTime() { + return expireTimeBuilder_ != null || expireTime_ != null; + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + public com.google.protobuf.Timestamp getExpireTime() { + if (expireTimeBuilder_ == null) { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } else { + return expireTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + expireTime_ = value; + onChanged(); + } else { + expireTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setExpireTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (expireTimeBuilder_ == null) { + expireTime_ = builderForValue.build(); + onChanged(); + } else { + expireTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeExpireTime(com.google.protobuf.Timestamp value) { + if (expireTimeBuilder_ == null) { + if (expireTime_ != null) { + expireTime_ = + com.google.protobuf.Timestamp.newBuilder(expireTime_).mergeFrom(value).buildPartial(); + } else { + expireTime_ = value; + } + onChanged(); + } else { + expireTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearExpireTime() { + if (expireTimeBuilder_ == null) { + expireTime_ = null; + onChanged(); + } else { + expireTime_ = null; + expireTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getExpireTimeBuilder() { + + onChanged(); + return getExpireTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder() { + if (expireTimeBuilder_ != null) { + return expireTimeBuilder_.getMessageOrBuilder(); + } else { + return expireTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : expireTime_; + } + } + /** + * + * + *
+     * Output only. For a deleted resource, the time after which it will be
+     * permamently deleted. It is only populated as a response to a Delete
+     * request.
+     * 
+ * + * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getExpireTimeFieldBuilder() { + if (expireTimeBuilder_ == null) { + expireTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getExpireTime(), getParentForChildren(), isClean()); + expireTime_ = null; + } + return expireTimeBuilder_; + } + + private java.lang.Object job_ = ""; + /** + * + * + *
+     * Output only. The name of the parent Job.
+     * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The job. + */ + public java.lang.String getJob() { + java.lang.Object ref = job_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + job_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The name of the parent Job.
+     * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for job. + */ + public com.google.protobuf.ByteString getJobBytes() { + java.lang.Object ref = job_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + job_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The name of the parent Job.
+     * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The job to set. + * @return This builder for chaining. + */ + public Builder setJob(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + job_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The name of the parent Job.
+     * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearJob() { + + job_ = getDefaultInstance().getJob(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The name of the parent Job.
+     * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for job to set. + * @return This builder for chaining. + */ + public Builder setJobBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + job_ = value; + onChanged(); + return this; + } + + private java.lang.Object execution_ = ""; + /** + * + * + *
+     * Output only. The name of the parent Execution.
+     * 
+ * + * + * string execution = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The execution. + */ + public java.lang.String getExecution() { + java.lang.Object ref = execution_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + execution_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The name of the parent Execution.
+     * 
+ * + * + * string execution = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for execution. + */ + public com.google.protobuf.ByteString getExecutionBytes() { + java.lang.Object ref = execution_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + execution_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The name of the parent Execution.
+     * 
+ * + * + * string execution = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The execution to set. + * @return This builder for chaining. + */ + public Builder setExecution(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + execution_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The name of the parent Execution.
+     * 
+ * + * + * string execution = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearExecution() { + + execution_ = getDefaultInstance().getExecution(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The name of the parent Execution.
+     * 
+ * + * + * string execution = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for execution to set. + * @return This builder for chaining. + */ + public Builder setExecutionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + execution_ = value; + onChanged(); + return this; + } + + private java.util.List containers_ = + java.util.Collections.emptyList(); + + private void ensureContainersIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + containers_ = new java.util.ArrayList(containers_); + bitField0_ |= 0x00000004; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Container, + com.google.cloud.run.v2.Container.Builder, + com.google.cloud.run.v2.ContainerOrBuilder> + containersBuilder_; + + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public java.util.List getContainersList() { + if (containersBuilder_ == null) { + return java.util.Collections.unmodifiableList(containers_); + } else { + return containersBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public int getContainersCount() { + if (containersBuilder_ == null) { + return containers_.size(); + } else { + return containersBuilder_.getCount(); + } + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public com.google.cloud.run.v2.Container getContainers(int index) { + if (containersBuilder_ == null) { + return containers_.get(index); + } else { + return containersBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public Builder setContainers(int index, com.google.cloud.run.v2.Container value) { + if (containersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContainersIsMutable(); + containers_.set(index, value); + onChanged(); + } else { + containersBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public Builder setContainers( + int index, com.google.cloud.run.v2.Container.Builder builderForValue) { + if (containersBuilder_ == null) { + ensureContainersIsMutable(); + containers_.set(index, builderForValue.build()); + onChanged(); + } else { + containersBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public Builder addContainers(com.google.cloud.run.v2.Container value) { + if (containersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContainersIsMutable(); + containers_.add(value); + onChanged(); + } else { + containersBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public Builder addContainers(int index, com.google.cloud.run.v2.Container value) { + if (containersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContainersIsMutable(); + containers_.add(index, value); + onChanged(); + } else { + containersBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public Builder addContainers(com.google.cloud.run.v2.Container.Builder builderForValue) { + if (containersBuilder_ == null) { + ensureContainersIsMutable(); + containers_.add(builderForValue.build()); + onChanged(); + } else { + containersBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public Builder addContainers( + int index, com.google.cloud.run.v2.Container.Builder builderForValue) { + if (containersBuilder_ == null) { + ensureContainersIsMutable(); + containers_.add(index, builderForValue.build()); + onChanged(); + } else { + containersBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public Builder addAllContainers( + java.lang.Iterable values) { + if (containersBuilder_ == null) { + ensureContainersIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, containers_); + onChanged(); + } else { + containersBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public Builder clearContainers() { + if (containersBuilder_ == null) { + containers_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + } else { + containersBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public Builder removeContainers(int index) { + if (containersBuilder_ == null) { + ensureContainersIsMutable(); + containers_.remove(index); + onChanged(); + } else { + containersBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public com.google.cloud.run.v2.Container.Builder getContainersBuilder(int index) { + return getContainersFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public com.google.cloud.run.v2.ContainerOrBuilder getContainersOrBuilder(int index) { + if (containersBuilder_ == null) { + return containers_.get(index); + } else { + return containersBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public java.util.List + getContainersOrBuilderList() { + if (containersBuilder_ != null) { + return containersBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(containers_); + } + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public com.google.cloud.run.v2.Container.Builder addContainersBuilder() { + return getContainersFieldBuilder() + .addBuilder(com.google.cloud.run.v2.Container.getDefaultInstance()); + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public com.google.cloud.run.v2.Container.Builder addContainersBuilder(int index) { + return getContainersFieldBuilder() + .addBuilder(index, com.google.cloud.run.v2.Container.getDefaultInstance()); + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + public java.util.List getContainersBuilderList() { + return getContainersFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Container, + com.google.cloud.run.v2.Container.Builder, + com.google.cloud.run.v2.ContainerOrBuilder> + getContainersFieldBuilder() { + if (containersBuilder_ == null) { + containersBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Container, + com.google.cloud.run.v2.Container.Builder, + com.google.cloud.run.v2.ContainerOrBuilder>( + containers_, ((bitField0_ & 0x00000004) != 0), getParentForChildren(), isClean()); + containers_ = null; + } + return containersBuilder_; + } + + private java.util.List volumes_ = + java.util.Collections.emptyList(); + + private void ensureVolumesIsMutable() { + if (!((bitField0_ & 0x00000008) != 0)) { + volumes_ = new java.util.ArrayList(volumes_); + bitField0_ |= 0x00000008; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Volume, + com.google.cloud.run.v2.Volume.Builder, + com.google.cloud.run.v2.VolumeOrBuilder> + volumesBuilder_; + + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public java.util.List getVolumesList() { + if (volumesBuilder_ == null) { + return java.util.Collections.unmodifiableList(volumes_); + } else { + return volumesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public int getVolumesCount() { + if (volumesBuilder_ == null) { + return volumes_.size(); + } else { + return volumesBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public com.google.cloud.run.v2.Volume getVolumes(int index) { + if (volumesBuilder_ == null) { + return volumes_.get(index); + } else { + return volumesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public Builder setVolumes(int index, com.google.cloud.run.v2.Volume value) { + if (volumesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureVolumesIsMutable(); + volumes_.set(index, value); + onChanged(); + } else { + volumesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public Builder setVolumes(int index, com.google.cloud.run.v2.Volume.Builder builderForValue) { + if (volumesBuilder_ == null) { + ensureVolumesIsMutable(); + volumes_.set(index, builderForValue.build()); + onChanged(); + } else { + volumesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public Builder addVolumes(com.google.cloud.run.v2.Volume value) { + if (volumesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureVolumesIsMutable(); + volumes_.add(value); + onChanged(); + } else { + volumesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public Builder addVolumes(int index, com.google.cloud.run.v2.Volume value) { + if (volumesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureVolumesIsMutable(); + volumes_.add(index, value); + onChanged(); + } else { + volumesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public Builder addVolumes(com.google.cloud.run.v2.Volume.Builder builderForValue) { + if (volumesBuilder_ == null) { + ensureVolumesIsMutable(); + volumes_.add(builderForValue.build()); + onChanged(); + } else { + volumesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public Builder addVolumes(int index, com.google.cloud.run.v2.Volume.Builder builderForValue) { + if (volumesBuilder_ == null) { + ensureVolumesIsMutable(); + volumes_.add(index, builderForValue.build()); + onChanged(); + } else { + volumesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public Builder addAllVolumes( + java.lang.Iterable values) { + if (volumesBuilder_ == null) { + ensureVolumesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, volumes_); + onChanged(); + } else { + volumesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public Builder clearVolumes() { + if (volumesBuilder_ == null) { + volumes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + } else { + volumesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public Builder removeVolumes(int index) { + if (volumesBuilder_ == null) { + ensureVolumesIsMutable(); + volumes_.remove(index); + onChanged(); + } else { + volumesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public com.google.cloud.run.v2.Volume.Builder getVolumesBuilder(int index) { + return getVolumesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public com.google.cloud.run.v2.VolumeOrBuilder getVolumesOrBuilder(int index) { + if (volumesBuilder_ == null) { + return volumes_.get(index); + } else { + return volumesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public java.util.List + getVolumesOrBuilderList() { + if (volumesBuilder_ != null) { + return volumesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(volumes_); + } + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public com.google.cloud.run.v2.Volume.Builder addVolumesBuilder() { + return getVolumesFieldBuilder() + .addBuilder(com.google.cloud.run.v2.Volume.getDefaultInstance()); + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public com.google.cloud.run.v2.Volume.Builder addVolumesBuilder(int index) { + return getVolumesFieldBuilder() + .addBuilder(index, com.google.cloud.run.v2.Volume.getDefaultInstance()); + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + public java.util.List getVolumesBuilderList() { + return getVolumesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Volume, + com.google.cloud.run.v2.Volume.Builder, + com.google.cloud.run.v2.VolumeOrBuilder> + getVolumesFieldBuilder() { + if (volumesBuilder_ == null) { + volumesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Volume, + com.google.cloud.run.v2.Volume.Builder, + com.google.cloud.run.v2.VolumeOrBuilder>( + volumes_, ((bitField0_ & 0x00000008) != 0), getParentForChildren(), isClean()); + volumes_ = null; + } + return volumesBuilder_; + } + + private int maxRetries_; + /** + * + * + *
+     * Number of retries allowed per Task, before marking this Task failed.
+     * 
+ * + * int32 max_retries = 16; + * + * @return The maxRetries. + */ + @java.lang.Override + public int getMaxRetries() { + return maxRetries_; + } + /** + * + * + *
+     * Number of retries allowed per Task, before marking this Task failed.
+     * 
+ * + * int32 max_retries = 16; + * + * @param value The maxRetries to set. + * @return This builder for chaining. + */ + public Builder setMaxRetries(int value) { + + maxRetries_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Number of retries allowed per Task, before marking this Task failed.
+     * 
+ * + * int32 max_retries = 16; + * + * @return This builder for chaining. + */ + public Builder clearMaxRetries() { + + maxRetries_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Duration timeout_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + timeoutBuilder_; + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 17; + * + * @return Whether the timeout field is set. + */ + public boolean hasTimeout() { + return timeoutBuilder_ != null || timeout_ != null; + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 17; + * + * @return The timeout. + */ + public com.google.protobuf.Duration getTimeout() { + if (timeoutBuilder_ == null) { + return timeout_ == null ? com.google.protobuf.Duration.getDefaultInstance() : timeout_; + } else { + return timeoutBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 17; + */ + public Builder setTimeout(com.google.protobuf.Duration value) { + if (timeoutBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + timeout_ = value; + onChanged(); + } else { + timeoutBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 17; + */ + public Builder setTimeout(com.google.protobuf.Duration.Builder builderForValue) { + if (timeoutBuilder_ == null) { + timeout_ = builderForValue.build(); + onChanged(); + } else { + timeoutBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 17; + */ + public Builder mergeTimeout(com.google.protobuf.Duration value) { + if (timeoutBuilder_ == null) { + if (timeout_ != null) { + timeout_ = + com.google.protobuf.Duration.newBuilder(timeout_).mergeFrom(value).buildPartial(); + } else { + timeout_ = value; + } + onChanged(); + } else { + timeoutBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 17; + */ + public Builder clearTimeout() { + if (timeoutBuilder_ == null) { + timeout_ = null; + onChanged(); + } else { + timeout_ = null; + timeoutBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 17; + */ + public com.google.protobuf.Duration.Builder getTimeoutBuilder() { + + onChanged(); + return getTimeoutFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 17; + */ + public com.google.protobuf.DurationOrBuilder getTimeoutOrBuilder() { + if (timeoutBuilder_ != null) { + return timeoutBuilder_.getMessageOrBuilder(); + } else { + return timeout_ == null ? com.google.protobuf.Duration.getDefaultInstance() : timeout_; + } + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 17; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + getTimeoutFieldBuilder() { + if (timeoutBuilder_ == null) { + timeoutBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder>( + getTimeout(), getParentForChildren(), isClean()); + timeout_ = null; + } + return timeoutBuilder_; + } + + private java.lang.Object serviceAccount_ = ""; + /** + * + * + *
+     * Email address of the IAM service account associated with the Task of a
+     * Job. The service account represents the identity of the
+     * running task, and determines what permissions the task has. If
+     * not provided, the task will use the project's default service account.
+     * 
+ * + * string service_account = 18; + * + * @return The serviceAccount. + */ + public java.lang.String getServiceAccount() { + java.lang.Object ref = serviceAccount_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceAccount_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Email address of the IAM service account associated with the Task of a
+     * Job. The service account represents the identity of the
+     * running task, and determines what permissions the task has. If
+     * not provided, the task will use the project's default service account.
+     * 
+ * + * string service_account = 18; + * + * @return The bytes for serviceAccount. + */ + public com.google.protobuf.ByteString getServiceAccountBytes() { + java.lang.Object ref = serviceAccount_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceAccount_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Email address of the IAM service account associated with the Task of a
+     * Job. The service account represents the identity of the
+     * running task, and determines what permissions the task has. If
+     * not provided, the task will use the project's default service account.
+     * 
+ * + * string service_account = 18; + * + * @param value The serviceAccount to set. + * @return This builder for chaining. + */ + public Builder setServiceAccount(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + serviceAccount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Email address of the IAM service account associated with the Task of a
+     * Job. The service account represents the identity of the
+     * running task, and determines what permissions the task has. If
+     * not provided, the task will use the project's default service account.
+     * 
+ * + * string service_account = 18; + * + * @return This builder for chaining. + */ + public Builder clearServiceAccount() { + + serviceAccount_ = getDefaultInstance().getServiceAccount(); + onChanged(); + return this; + } + /** + * + * + *
+     * Email address of the IAM service account associated with the Task of a
+     * Job. The service account represents the identity of the
+     * running task, and determines what permissions the task has. If
+     * not provided, the task will use the project's default service account.
+     * 
+ * + * string service_account = 18; + * + * @param value The bytes for serviceAccount to set. + * @return This builder for chaining. + */ + public Builder setServiceAccountBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + serviceAccount_ = value; + onChanged(); + return this; + } + + private int executionEnvironment_ = 0; + /** + * + * + *
+     * The execution environment being used to host this Task.
+     * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 20; + * + * @return The enum numeric value on the wire for executionEnvironment. + */ + @java.lang.Override + public int getExecutionEnvironmentValue() { + return executionEnvironment_; + } + /** + * + * + *
+     * The execution environment being used to host this Task.
+     * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 20; + * + * @param value The enum numeric value on the wire for executionEnvironment to set. + * @return This builder for chaining. + */ + public Builder setExecutionEnvironmentValue(int value) { + + executionEnvironment_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The execution environment being used to host this Task.
+     * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 20; + * + * @return The executionEnvironment. + */ + @java.lang.Override + public com.google.cloud.run.v2.ExecutionEnvironment getExecutionEnvironment() { + @SuppressWarnings("deprecation") + com.google.cloud.run.v2.ExecutionEnvironment result = + com.google.cloud.run.v2.ExecutionEnvironment.valueOf(executionEnvironment_); + return result == null ? com.google.cloud.run.v2.ExecutionEnvironment.UNRECOGNIZED : result; + } + /** + * + * + *
+     * The execution environment being used to host this Task.
+     * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 20; + * + * @param value The executionEnvironment to set. + * @return This builder for chaining. + */ + public Builder setExecutionEnvironment(com.google.cloud.run.v2.ExecutionEnvironment value) { + if (value == null) { + throw new NullPointerException(); + } + + executionEnvironment_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The execution environment being used to host this Task.
+     * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 20; + * + * @return This builder for chaining. + */ + public Builder clearExecutionEnvironment() { + + executionEnvironment_ = 0; + onChanged(); + return this; + } + + private boolean reconciling_; + /** + * + * + *
+     * Output only. Indicates whether the resource's reconciliation is still in progress.
+     * See comments in `Job.reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * bool reconciling = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + @java.lang.Override + public boolean getReconciling() { + return reconciling_; + } + /** + * + * + *
+     * Output only. Indicates whether the resource's reconciliation is still in progress.
+     * See comments in `Job.reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * bool reconciling = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The reconciling to set. + * @return This builder for chaining. + */ + public Builder setReconciling(boolean value) { + + reconciling_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Indicates whether the resource's reconciliation is still in progress.
+     * See comments in `Job.reconciling` for additional information on
+     * reconciliation process in Cloud Run.
+     * 
+ * + * bool reconciling = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearReconciling() { + + reconciling_ = false; + onChanged(); + return this; + } + + private java.util.List conditions_ = + java.util.Collections.emptyList(); + + private void ensureConditionsIsMutable() { + if (!((bitField0_ & 0x00000010) != 0)) { + conditions_ = new java.util.ArrayList(conditions_); + bitField0_ |= 0x00000010; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Condition, + com.google.cloud.run.v2.Condition.Builder, + com.google.cloud.run.v2.ConditionOrBuilder> + conditionsBuilder_; + + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List getConditionsList() { + if (conditionsBuilder_ == null) { + return java.util.Collections.unmodifiableList(conditions_); + } else { + return conditionsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public int getConditionsCount() { + if (conditionsBuilder_ == null) { + return conditions_.size(); + } else { + return conditionsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.Condition getConditions(int index) { + if (conditionsBuilder_ == null) { + return conditions_.get(index); + } else { + return conditionsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setConditions(int index, com.google.cloud.run.v2.Condition value) { + if (conditionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureConditionsIsMutable(); + conditions_.set(index, value); + onChanged(); + } else { + conditionsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setConditions( + int index, com.google.cloud.run.v2.Condition.Builder builderForValue) { + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + conditions_.set(index, builderForValue.build()); + onChanged(); + } else { + conditionsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addConditions(com.google.cloud.run.v2.Condition value) { + if (conditionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureConditionsIsMutable(); + conditions_.add(value); + onChanged(); + } else { + conditionsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addConditions(int index, com.google.cloud.run.v2.Condition value) { + if (conditionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureConditionsIsMutable(); + conditions_.add(index, value); + onChanged(); + } else { + conditionsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addConditions(com.google.cloud.run.v2.Condition.Builder builderForValue) { + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + conditions_.add(builderForValue.build()); + onChanged(); + } else { + conditionsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addConditions( + int index, com.google.cloud.run.v2.Condition.Builder builderForValue) { + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + conditions_.add(index, builderForValue.build()); + onChanged(); + } else { + conditionsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addAllConditions( + java.lang.Iterable values) { + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, conditions_); + onChanged(); + } else { + conditionsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearConditions() { + if (conditionsBuilder_ == null) { + conditions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + } else { + conditionsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder removeConditions(int index) { + if (conditionsBuilder_ == null) { + ensureConditionsIsMutable(); + conditions_.remove(index); + onChanged(); + } else { + conditionsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.Condition.Builder getConditionsBuilder(int index) { + return getConditionsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.ConditionOrBuilder getConditionsOrBuilder(int index) { + if (conditionsBuilder_ == null) { + return conditions_.get(index); + } else { + return conditionsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List + getConditionsOrBuilderList() { + if (conditionsBuilder_ != null) { + return conditionsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(conditions_); + } + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.Condition.Builder addConditionsBuilder() { + return getConditionsFieldBuilder() + .addBuilder(com.google.cloud.run.v2.Condition.getDefaultInstance()); + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.Condition.Builder addConditionsBuilder(int index) { + return getConditionsFieldBuilder() + .addBuilder(index, com.google.cloud.run.v2.Condition.getDefaultInstance()); + } + /** + * + * + *
+     * Output only. The Condition of this Task, containing its readiness status, and
+     * detailed error information in case it did not reach the desired state.
+     * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List getConditionsBuilderList() { + return getConditionsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Condition, + com.google.cloud.run.v2.Condition.Builder, + com.google.cloud.run.v2.ConditionOrBuilder> + getConditionsFieldBuilder() { + if (conditionsBuilder_ == null) { + conditionsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Condition, + com.google.cloud.run.v2.Condition.Builder, + com.google.cloud.run.v2.ConditionOrBuilder>( + conditions_, ((bitField0_ & 0x00000010) != 0), getParentForChildren(), isClean()); + conditions_ = null; + } + return conditionsBuilder_; + } + + private long observedGeneration_; + /** + * + * + *
+     * Output only. The generation of this Task. See comments in `Job.reconciling`
+     * for additional information on reconciliation process in Cloud Run.
+     * 
+ * + * int64 observed_generation = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The observedGeneration. + */ + @java.lang.Override + public long getObservedGeneration() { + return observedGeneration_; + } + /** + * + * + *
+     * Output only. The generation of this Task. See comments in `Job.reconciling`
+     * for additional information on reconciliation process in Cloud Run.
+     * 
+ * + * int64 observed_generation = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The observedGeneration to set. + * @return This builder for chaining. + */ + public Builder setObservedGeneration(long value) { + + observedGeneration_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The generation of this Task. See comments in `Job.reconciling`
+     * for additional information on reconciliation process in Cloud Run.
+     * 
+ * + * int64 observed_generation = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearObservedGeneration() { + + observedGeneration_ = 0L; + onChanged(); + return this; + } + + private int index_; + /** + * + * + *
+     * Output only. Index of the Task, unique per execution, and beginning at 0.
+     * 
+ * + * int32 index = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The index. + */ + @java.lang.Override + public int getIndex() { + return index_; + } + /** + * + * + *
+     * Output only. Index of the Task, unique per execution, and beginning at 0.
+     * 
+ * + * int32 index = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The index to set. + * @return This builder for chaining. + */ + public Builder setIndex(int value) { + + index_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Index of the Task, unique per execution, and beginning at 0.
+     * 
+ * + * int32 index = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearIndex() { + + index_ = 0; + onChanged(); + return this; + } + + private int retried_; + /** + * + * + *
+     * Output only. The number of times this Task was retried.
+     * Tasks are retried when they fail up to the maxRetries limit.
+     * 
+ * + * int32 retried = 25 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The retried. + */ + @java.lang.Override + public int getRetried() { + return retried_; + } + /** + * + * + *
+     * Output only. The number of times this Task was retried.
+     * Tasks are retried when they fail up to the maxRetries limit.
+     * 
+ * + * int32 retried = 25 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The retried to set. + * @return This builder for chaining. + */ + public Builder setRetried(int value) { + + retried_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The number of times this Task was retried.
+     * Tasks are retried when they fail up to the maxRetries limit.
+     * 
+ * + * int32 retried = 25 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearRetried() { + + retried_ = 0; + onChanged(); + return this; + } + + private com.google.cloud.run.v2.TaskAttemptResult lastAttemptResult_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.TaskAttemptResult, + com.google.cloud.run.v2.TaskAttemptResult.Builder, + com.google.cloud.run.v2.TaskAttemptResultOrBuilder> + lastAttemptResultBuilder_; + /** + * + * + *
+     * Output only. Result of the last attempt of this Task.
+     * 
+ * + * + * .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the lastAttemptResult field is set. + */ + public boolean hasLastAttemptResult() { + return lastAttemptResultBuilder_ != null || lastAttemptResult_ != null; + } + /** + * + * + *
+     * Output only. Result of the last attempt of this Task.
+     * 
+ * + * + * .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastAttemptResult. + */ + public com.google.cloud.run.v2.TaskAttemptResult getLastAttemptResult() { + if (lastAttemptResultBuilder_ == null) { + return lastAttemptResult_ == null + ? com.google.cloud.run.v2.TaskAttemptResult.getDefaultInstance() + : lastAttemptResult_; + } else { + return lastAttemptResultBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Result of the last attempt of this Task.
+     * 
+ * + * + * .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setLastAttemptResult(com.google.cloud.run.v2.TaskAttemptResult value) { + if (lastAttemptResultBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + lastAttemptResult_ = value; + onChanged(); + } else { + lastAttemptResultBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Result of the last attempt of this Task.
+     * 
+ * + * + * .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setLastAttemptResult( + com.google.cloud.run.v2.TaskAttemptResult.Builder builderForValue) { + if (lastAttemptResultBuilder_ == null) { + lastAttemptResult_ = builderForValue.build(); + onChanged(); + } else { + lastAttemptResultBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. Result of the last attempt of this Task.
+     * 
+ * + * + * .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeLastAttemptResult(com.google.cloud.run.v2.TaskAttemptResult value) { + if (lastAttemptResultBuilder_ == null) { + if (lastAttemptResult_ != null) { + lastAttemptResult_ = + com.google.cloud.run.v2.TaskAttemptResult.newBuilder(lastAttemptResult_) + .mergeFrom(value) + .buildPartial(); + } else { + lastAttemptResult_ = value; + } + onChanged(); + } else { + lastAttemptResultBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. Result of the last attempt of this Task.
+     * 
+ * + * + * .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearLastAttemptResult() { + if (lastAttemptResultBuilder_ == null) { + lastAttemptResult_ = null; + onChanged(); + } else { + lastAttemptResult_ = null; + lastAttemptResultBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. Result of the last attempt of this Task.
+     * 
+ * + * + * .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.TaskAttemptResult.Builder getLastAttemptResultBuilder() { + + onChanged(); + return getLastAttemptResultFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Result of the last attempt of this Task.
+     * 
+ * + * + * .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.TaskAttemptResultOrBuilder getLastAttemptResultOrBuilder() { + if (lastAttemptResultBuilder_ != null) { + return lastAttemptResultBuilder_.getMessageOrBuilder(); + } else { + return lastAttemptResult_ == null + ? com.google.cloud.run.v2.TaskAttemptResult.getDefaultInstance() + : lastAttemptResult_; + } + } + /** + * + * + *
+     * Output only. Result of the last attempt of this Task.
+     * 
+ * + * + * .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.TaskAttemptResult, + com.google.cloud.run.v2.TaskAttemptResult.Builder, + com.google.cloud.run.v2.TaskAttemptResultOrBuilder> + getLastAttemptResultFieldBuilder() { + if (lastAttemptResultBuilder_ == null) { + lastAttemptResultBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.TaskAttemptResult, + com.google.cloud.run.v2.TaskAttemptResult.Builder, + com.google.cloud.run.v2.TaskAttemptResultOrBuilder>( + getLastAttemptResult(), getParentForChildren(), isClean()); + lastAttemptResult_ = null; + } + return lastAttemptResultBuilder_; + } + + private java.lang.Object encryptionKey_ = ""; + /** + * + * + *
+     * Output only. A reference to a customer managed encryption key (CMEK) to use to encrypt
+     * this container image. For more information, go to
+     * https://cloud.google.com/run/docs/securing/using-cmek
+     * 
+ * + * + * string encryption_key = 28 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The encryptionKey. + */ + public java.lang.String getEncryptionKey() { + java.lang.Object ref = encryptionKey_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + encryptionKey_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. A reference to a customer managed encryption key (CMEK) to use to encrypt
+     * this container image. For more information, go to
+     * https://cloud.google.com/run/docs/securing/using-cmek
+     * 
+ * + * + * string encryption_key = 28 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for encryptionKey. + */ + public com.google.protobuf.ByteString getEncryptionKeyBytes() { + java.lang.Object ref = encryptionKey_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + encryptionKey_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. A reference to a customer managed encryption key (CMEK) to use to encrypt
+     * this container image. For more information, go to
+     * https://cloud.google.com/run/docs/securing/using-cmek
+     * 
+ * + * + * string encryption_key = 28 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The encryptionKey to set. + * @return This builder for chaining. + */ + public Builder setEncryptionKey(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + encryptionKey_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. A reference to a customer managed encryption key (CMEK) to use to encrypt
+     * this container image. For more information, go to
+     * https://cloud.google.com/run/docs/securing/using-cmek
+     * 
+ * + * + * string encryption_key = 28 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearEncryptionKey() { + + encryptionKey_ = getDefaultInstance().getEncryptionKey(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. A reference to a customer managed encryption key (CMEK) to use to encrypt
+     * this container image. For more information, go to
+     * https://cloud.google.com/run/docs/securing/using-cmek
+     * 
+ * + * + * string encryption_key = 28 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for encryptionKey to set. + * @return This builder for chaining. + */ + public Builder setEncryptionKeyBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + encryptionKey_ = value; + onChanged(); + return this; + } + + private com.google.cloud.run.v2.VpcAccess vpcAccess_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.VpcAccess, + com.google.cloud.run.v2.VpcAccess.Builder, + com.google.cloud.run.v2.VpcAccessOrBuilder> + vpcAccessBuilder_; + /** + * + * + *
+     * Output only. VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * + * .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the vpcAccess field is set. + */ + public boolean hasVpcAccess() { + return vpcAccessBuilder_ != null || vpcAccess_ != null; + } + /** + * + * + *
+     * Output only. VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * + * .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The vpcAccess. + */ + public com.google.cloud.run.v2.VpcAccess getVpcAccess() { + if (vpcAccessBuilder_ == null) { + return vpcAccess_ == null + ? com.google.cloud.run.v2.VpcAccess.getDefaultInstance() + : vpcAccess_; + } else { + return vpcAccessBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * + * .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setVpcAccess(com.google.cloud.run.v2.VpcAccess value) { + if (vpcAccessBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + vpcAccess_ = value; + onChanged(); + } else { + vpcAccessBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * + * .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setVpcAccess(com.google.cloud.run.v2.VpcAccess.Builder builderForValue) { + if (vpcAccessBuilder_ == null) { + vpcAccess_ = builderForValue.build(); + onChanged(); + } else { + vpcAccessBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * + * .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeVpcAccess(com.google.cloud.run.v2.VpcAccess value) { + if (vpcAccessBuilder_ == null) { + if (vpcAccess_ != null) { + vpcAccess_ = + com.google.cloud.run.v2.VpcAccess.newBuilder(vpcAccess_) + .mergeFrom(value) + .buildPartial(); + } else { + vpcAccess_ = value; + } + onChanged(); + } else { + vpcAccessBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * + * .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearVpcAccess() { + if (vpcAccessBuilder_ == null) { + vpcAccess_ = null; + onChanged(); + } else { + vpcAccess_ = null; + vpcAccessBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * + * .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.VpcAccess.Builder getVpcAccessBuilder() { + + onChanged(); + return getVpcAccessFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * + * .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.run.v2.VpcAccessOrBuilder getVpcAccessOrBuilder() { + if (vpcAccessBuilder_ != null) { + return vpcAccessBuilder_.getMessageOrBuilder(); + } else { + return vpcAccess_ == null + ? com.google.cloud.run.v2.VpcAccess.getDefaultInstance() + : vpcAccess_; + } + } + /** + * + * + *
+     * Output only. VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * + * .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.VpcAccess, + com.google.cloud.run.v2.VpcAccess.Builder, + com.google.cloud.run.v2.VpcAccessOrBuilder> + getVpcAccessFieldBuilder() { + if (vpcAccessBuilder_ == null) { + vpcAccessBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.VpcAccess, + com.google.cloud.run.v2.VpcAccess.Builder, + com.google.cloud.run.v2.VpcAccessOrBuilder>( + getVpcAccess(), getParentForChildren(), isClean()); + vpcAccess_ = null; + } + return vpcAccessBuilder_; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * Output only. A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. A system-generated fingerprint for this version of the
+     * resource. May be used to detect modification conflict during updates.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.Task) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.Task) + private static final com.google.cloud.run.v2.Task DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.Task(); + } + + public static com.google.cloud.run.v2.Task getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Task parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.Task getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskAttemptResult.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskAttemptResult.java new file mode 100644 index 000000000000..5f75c97c56d6 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskAttemptResult.java @@ -0,0 +1,803 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/task.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Result of a task attempt.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.TaskAttemptResult} + */ +public final class TaskAttemptResult extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.TaskAttemptResult) + TaskAttemptResultOrBuilder { + private static final long serialVersionUID = 0L; + // Use TaskAttemptResult.newBuilder() to construct. + private TaskAttemptResult(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private TaskAttemptResult() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new TaskAttemptResult(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_TaskAttemptResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_TaskAttemptResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.TaskAttemptResult.class, + com.google.cloud.run.v2.TaskAttemptResult.Builder.class); + } + + public static final int STATUS_FIELD_NUMBER = 1; + private com.google.rpc.Status status_; + /** + * + * + *
+   * Output only. The status of this attempt.
+   * If the status code is OK, then the attempt succeeded.
+   * 
+ * + * .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return Whether the status field is set. + */ + @java.lang.Override + public boolean hasStatus() { + return status_ != null; + } + /** + * + * + *
+   * Output only. The status of this attempt.
+   * If the status code is OK, then the attempt succeeded.
+   * 
+ * + * .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The status. + */ + @java.lang.Override + public com.google.rpc.Status getStatus() { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } + /** + * + * + *
+   * Output only. The status of this attempt.
+   * If the status code is OK, then the attempt succeeded.
+   * 
+ * + * .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + @java.lang.Override + public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { + return getStatus(); + } + + public static final int EXIT_CODE_FIELD_NUMBER = 2; + private int exitCode_; + /** + * + * + *
+   * Output only. The exit code of this attempt.
+   * This may be unset if the container was unable to exit cleanly with a code
+   * due to some other failure.
+   * See status field for possible failure details.
+   * 
+ * + * int32 exit_code = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The exitCode. + */ + @java.lang.Override + public int getExitCode() { + return exitCode_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (status_ != null) { + output.writeMessage(1, getStatus()); + } + if (exitCode_ != 0) { + output.writeInt32(2, exitCode_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (status_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getStatus()); + } + if (exitCode_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, exitCode_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.TaskAttemptResult)) { + return super.equals(obj); + } + com.google.cloud.run.v2.TaskAttemptResult other = + (com.google.cloud.run.v2.TaskAttemptResult) obj; + + if (hasStatus() != other.hasStatus()) return false; + if (hasStatus()) { + if (!getStatus().equals(other.getStatus())) return false; + } + if (getExitCode() != other.getExitCode()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasStatus()) { + hash = (37 * hash) + STATUS_FIELD_NUMBER; + hash = (53 * hash) + getStatus().hashCode(); + } + hash = (37 * hash) + EXIT_CODE_FIELD_NUMBER; + hash = (53 * hash) + getExitCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.TaskAttemptResult parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.TaskAttemptResult parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.TaskAttemptResult parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.TaskAttemptResult parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.TaskAttemptResult parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.TaskAttemptResult parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.TaskAttemptResult parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.TaskAttemptResult parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.TaskAttemptResult parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.TaskAttemptResult parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.TaskAttemptResult parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.TaskAttemptResult parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.TaskAttemptResult prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Result of a task attempt.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.TaskAttemptResult} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.TaskAttemptResult) + com.google.cloud.run.v2.TaskAttemptResultOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_TaskAttemptResult_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_TaskAttemptResult_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.TaskAttemptResult.class, + com.google.cloud.run.v2.TaskAttemptResult.Builder.class); + } + + // Construct using com.google.cloud.run.v2.TaskAttemptResult.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (statusBuilder_ == null) { + status_ = null; + } else { + status_ = null; + statusBuilder_ = null; + } + exitCode_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.TaskProto + .internal_static_google_cloud_run_v2_TaskAttemptResult_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.TaskAttemptResult getDefaultInstanceForType() { + return com.google.cloud.run.v2.TaskAttemptResult.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.TaskAttemptResult build() { + com.google.cloud.run.v2.TaskAttemptResult result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.TaskAttemptResult buildPartial() { + com.google.cloud.run.v2.TaskAttemptResult result = + new com.google.cloud.run.v2.TaskAttemptResult(this); + if (statusBuilder_ == null) { + result.status_ = status_; + } else { + result.status_ = statusBuilder_.build(); + } + result.exitCode_ = exitCode_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.TaskAttemptResult) { + return mergeFrom((com.google.cloud.run.v2.TaskAttemptResult) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.TaskAttemptResult other) { + if (other == com.google.cloud.run.v2.TaskAttemptResult.getDefaultInstance()) return this; + if (other.hasStatus()) { + mergeStatus(other.getStatus()); + } + if (other.getExitCode() != 0) { + setExitCode(other.getExitCode()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(getStatusFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 10 + case 16: + { + exitCode_ = input.readInt32(); + + break; + } // case 16 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private com.google.rpc.Status status_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + statusBuilder_; + /** + * + * + *
+     * Output only. The status of this attempt.
+     * If the status code is OK, then the attempt succeeded.
+     * 
+ * + * .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return Whether the status field is set. + */ + public boolean hasStatus() { + return statusBuilder_ != null || status_ != null; + } + /** + * + * + *
+     * Output only. The status of this attempt.
+     * If the status code is OK, then the attempt succeeded.
+     * 
+ * + * .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The status. + */ + public com.google.rpc.Status getStatus() { + if (statusBuilder_ == null) { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } else { + return statusBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The status of this attempt.
+     * If the status code is OK, then the attempt succeeded.
+     * 
+ * + * .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public Builder setStatus(com.google.rpc.Status value) { + if (statusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + status_ = value; + onChanged(); + } else { + statusBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The status of this attempt.
+     * If the status code is OK, then the attempt succeeded.
+     * 
+ * + * .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public Builder setStatus(com.google.rpc.Status.Builder builderForValue) { + if (statusBuilder_ == null) { + status_ = builderForValue.build(); + onChanged(); + } else { + statusBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The status of this attempt.
+     * If the status code is OK, then the attempt succeeded.
+     * 
+ * + * .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public Builder mergeStatus(com.google.rpc.Status value) { + if (statusBuilder_ == null) { + if (status_ != null) { + status_ = com.google.rpc.Status.newBuilder(status_).mergeFrom(value).buildPartial(); + } else { + status_ = value; + } + onChanged(); + } else { + statusBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The status of this attempt.
+     * If the status code is OK, then the attempt succeeded.
+     * 
+ * + * .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public Builder clearStatus() { + if (statusBuilder_ == null) { + status_ = null; + onChanged(); + } else { + status_ = null; + statusBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The status of this attempt.
+     * If the status code is OK, then the attempt succeeded.
+     * 
+ * + * .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public com.google.rpc.Status.Builder getStatusBuilder() { + + onChanged(); + return getStatusFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The status of this attempt.
+     * If the status code is OK, then the attempt succeeded.
+     * 
+ * + * .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { + if (statusBuilder_ != null) { + return statusBuilder_.getMessageOrBuilder(); + } else { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } + } + /** + * + * + *
+     * Output only. The status of this attempt.
+     * If the status code is OK, then the attempt succeeded.
+     * 
+ * + * .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + getStatusFieldBuilder() { + if (statusBuilder_ == null) { + statusBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, + com.google.rpc.Status.Builder, + com.google.rpc.StatusOrBuilder>(getStatus(), getParentForChildren(), isClean()); + status_ = null; + } + return statusBuilder_; + } + + private int exitCode_; + /** + * + * + *
+     * Output only. The exit code of this attempt.
+     * This may be unset if the container was unable to exit cleanly with a code
+     * due to some other failure.
+     * See status field for possible failure details.
+     * 
+ * + * int32 exit_code = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The exitCode. + */ + @java.lang.Override + public int getExitCode() { + return exitCode_; + } + /** + * + * + *
+     * Output only. The exit code of this attempt.
+     * This may be unset if the container was unable to exit cleanly with a code
+     * due to some other failure.
+     * See status field for possible failure details.
+     * 
+ * + * int32 exit_code = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The exitCode to set. + * @return This builder for chaining. + */ + public Builder setExitCode(int value) { + + exitCode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The exit code of this attempt.
+     * This may be unset if the container was unable to exit cleanly with a code
+     * due to some other failure.
+     * See status field for possible failure details.
+     * 
+ * + * int32 exit_code = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearExitCode() { + + exitCode_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.TaskAttemptResult) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.TaskAttemptResult) + private static final com.google.cloud.run.v2.TaskAttemptResult DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.TaskAttemptResult(); + } + + public static com.google.cloud.run.v2.TaskAttemptResult getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TaskAttemptResult parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.TaskAttemptResult getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskAttemptResultOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskAttemptResultOrBuilder.java new file mode 100644 index 000000000000..780e41b09879 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskAttemptResultOrBuilder.java @@ -0,0 +1,79 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/task.proto + +package com.google.cloud.run.v2; + +public interface TaskAttemptResultOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.TaskAttemptResult) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. The status of this attempt.
+   * If the status code is OK, then the attempt succeeded.
+   * 
+ * + * .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return Whether the status field is set. + */ + boolean hasStatus(); + /** + * + * + *
+   * Output only. The status of this attempt.
+   * If the status code is OK, then the attempt succeeded.
+   * 
+ * + * .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The status. + */ + com.google.rpc.Status getStatus(); + /** + * + * + *
+   * Output only. The status of this attempt.
+   * If the status code is OK, then the attempt succeeded.
+   * 
+ * + * .google.rpc.Status status = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + com.google.rpc.StatusOrBuilder getStatusOrBuilder(); + + /** + * + * + *
+   * Output only. The exit code of this attempt.
+   * This may be unset if the container was unable to exit cleanly with a code
+   * due to some other failure.
+   * See status field for possible failure details.
+   * 
+ * + * int32 exit_code = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The exitCode. + */ + int getExitCode(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskName.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskName.java new file mode 100644 index 000000000000..7a9e194efb1b --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskName.java @@ -0,0 +1,289 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.run.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class TaskName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_JOB_EXECUTION_TASK = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String job; + private final String execution; + private final String task; + + @Deprecated + protected TaskName() { + project = null; + location = null; + job = null; + execution = null; + task = null; + } + + private TaskName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + job = Preconditions.checkNotNull(builder.getJob()); + execution = Preconditions.checkNotNull(builder.getExecution()); + task = Preconditions.checkNotNull(builder.getTask()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getJob() { + return job; + } + + public String getExecution() { + return execution; + } + + public String getTask() { + return task; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static TaskName of( + String project, String location, String job, String execution, String task) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setJob(job) + .setExecution(execution) + .setTask(task) + .build(); + } + + public static String format( + String project, String location, String job, String execution, String task) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setJob(job) + .setExecution(execution) + .setTask(task) + .build() + .toString(); + } + + public static TaskName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_JOB_EXECUTION_TASK.validatedMatch( + formattedString, "TaskName.parse: formattedString not in valid format"); + return of( + matchMap.get("project"), + matchMap.get("location"), + matchMap.get("job"), + matchMap.get("execution"), + matchMap.get("task")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (TaskName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_JOB_EXECUTION_TASK.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (job != null) { + fieldMapBuilder.put("job", job); + } + if (execution != null) { + fieldMapBuilder.put("execution", execution); + } + if (task != null) { + fieldMapBuilder.put("task", task); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_JOB_EXECUTION_TASK.instantiate( + "project", project, "location", location, "job", job, "execution", execution, "task", task); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + TaskName that = ((TaskName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.job, that.job) + && Objects.equals(this.execution, that.execution) + && Objects.equals(this.task, that.task); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(job); + h *= 1000003; + h ^= Objects.hashCode(execution); + h *= 1000003; + h ^= Objects.hashCode(task); + return h; + } + + /** + * Builder for + * projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}. + */ + public static class Builder { + private String project; + private String location; + private String job; + private String execution; + private String task; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getJob() { + return job; + } + + public String getExecution() { + return execution; + } + + public String getTask() { + return task; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setJob(String job) { + this.job = job; + return this; + } + + public Builder setExecution(String execution) { + this.execution = execution; + return this; + } + + public Builder setTask(String task) { + this.task = task; + return this; + } + + private Builder(TaskName taskName) { + this.project = taskName.project; + this.location = taskName.location; + this.job = taskName.job; + this.execution = taskName.execution; + this.task = taskName.task; + } + + public TaskName build() { + return new TaskName(this); + } + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskOrBuilder.java new file mode 100644 index 000000000000..6d7c411acff3 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskOrBuilder.java @@ -0,0 +1,1046 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/task.proto + +package com.google.cloud.run.v2; + +public interface TaskOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.Task) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. The unique name of this Task.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Output only. The unique name of this Task.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Output only. Server assigned unique identifier for the Task. The value is a UUID4
+   * string and guaranteed to remain unchanged until the resource is deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + java.lang.String getUid(); + /** + * + * + *
+   * Output only. Server assigned unique identifier for the Task. The value is a UUID4
+   * string and guaranteed to remain unchanged until the resource is deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + com.google.protobuf.ByteString getUidBytes(); + + /** + * + * + *
+   * Output only. A number that monotonically increases every time the user
+   * modifies the desired state.
+   * 
+ * + * int64 generation = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The generation. + */ + long getGeneration(); + + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + int getLabelsCount(); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getLabels(); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + java.util.Map getLabelsMap(); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + + /* nullable */ + java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * KRM-style labels for the resource.
+   * User-provided labels are shared with Google's billing system, so they can
+   * be used to filter, or break down billing charges by team, component,
+   * environment, state, etc. For more information, visit
+   * https://cloud.google.com/resource-manager/docs/creating-managing-labels or
+   * https://cloud.google.com/run/docs/configuring/labels
+   * Cloud Run will populate some labels with 'run.googleapis.com' or
+   * 'serving.knative.dev' namespaces. Those labels are read-only, and user
+   * changes will not be preserved.
+   * 
+ * + * map<string, string> labels = 4; + */ + java.lang.String getLabelsOrThrow(java.lang.String key); + + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + int getAnnotationsCount(); + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + boolean containsAnnotations(java.lang.String key); + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getAnnotations(); + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + java.util.Map getAnnotationsMap(); + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + + /* nullable */ + java.lang.String getAnnotationsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * KRM-style annotations for the resource.
+   * 
+ * + * map<string, string> annotations = 5; + */ + java.lang.String getAnnotationsOrThrow(java.lang.String key); + + /** + * + * + *
+   * Output only. Represents time when the task was created by the job controller.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Output only. Represents time when the task was created by the job controller.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Output only. Represents time when the task was created by the job controller.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. Represents time when the task started to run.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the startTime field is set. + */ + boolean hasStartTime(); + /** + * + * + *
+   * Output only. Represents time when the task started to run.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The startTime. + */ + com.google.protobuf.Timestamp getStartTime(); + /** + * + * + *
+   * Output only. Represents time when the task started to run.
+   * It is not guaranteed to be set in happens-before order across separate
+   * operations.
+   * 
+ * + * .google.protobuf.Timestamp start_time = 27 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder(); + + /** + * + * + *
+   * Output only. Represents time when the Task was completed. It is not guaranteed to
+   * be set in happens-before order across separate operations.
+   * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the completionTime field is set. + */ + boolean hasCompletionTime(); + /** + * + * + *
+   * Output only. Represents time when the Task was completed. It is not guaranteed to
+   * be set in happens-before order across separate operations.
+   * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The completionTime. + */ + com.google.protobuf.Timestamp getCompletionTime(); + /** + * + * + *
+   * Output only. Represents time when the Task was completed. It is not guaranteed to
+   * be set in happens-before order across separate operations.
+   * 
+ * + * + * .google.protobuf.Timestamp completion_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCompletionTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. For a deleted resource, the deletion time. It is only
+   * populated as a response to a Delete request.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + boolean hasDeleteTime(); + /** + * + * + *
+   * Output only. For a deleted resource, the deletion time. It is only
+   * populated as a response to a Delete request.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + com.google.protobuf.Timestamp getDeleteTime(); + /** + * + * + *
+   * Output only. For a deleted resource, the deletion time. It is only
+   * populated as a response to a Delete request.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder(); + + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted. It is only populated as a response to a Delete
+   * request.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the expireTime field is set. + */ + boolean hasExpireTime(); + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted. It is only populated as a response to a Delete
+   * request.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The expireTime. + */ + com.google.protobuf.Timestamp getExpireTime(); + /** + * + * + *
+   * Output only. For a deleted resource, the time after which it will be
+   * permamently deleted. It is only populated as a response to a Delete
+   * request.
+   * 
+ * + * .google.protobuf.Timestamp expire_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getExpireTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The name of the parent Job.
+   * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The job. + */ + java.lang.String getJob(); + /** + * + * + *
+   * Output only. The name of the parent Job.
+   * 
+ * + * + * string job = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for job. + */ + com.google.protobuf.ByteString getJobBytes(); + + /** + * + * + *
+   * Output only. The name of the parent Execution.
+   * 
+ * + * + * string execution = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The execution. + */ + java.lang.String getExecution(); + /** + * + * + *
+   * Output only. The name of the parent Execution.
+   * 
+ * + * + * string execution = 13 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for execution. + */ + com.google.protobuf.ByteString getExecutionBytes(); + + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + java.util.List getContainersList(); + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + com.google.cloud.run.v2.Container getContainers(int index); + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + int getContainersCount(); + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + java.util.List getContainersOrBuilderList(); + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 14; + */ + com.google.cloud.run.v2.ContainerOrBuilder getContainersOrBuilder(int index); + + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + java.util.List getVolumesList(); + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + com.google.cloud.run.v2.Volume getVolumes(int index); + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + int getVolumesCount(); + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + java.util.List getVolumesOrBuilderList(); + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 15; + */ + com.google.cloud.run.v2.VolumeOrBuilder getVolumesOrBuilder(int index); + + /** + * + * + *
+   * Number of retries allowed per Task, before marking this Task failed.
+   * 
+ * + * int32 max_retries = 16; + * + * @return The maxRetries. + */ + int getMaxRetries(); + + /** + * + * + *
+   * Max allowed time duration the Task may be active before the system will
+   * actively try to mark it failed and kill associated containers. This applies
+   * per attempt of a task, meaning each retry can run for the full timeout.
+   * 
+ * + * .google.protobuf.Duration timeout = 17; + * + * @return Whether the timeout field is set. + */ + boolean hasTimeout(); + /** + * + * + *
+   * Max allowed time duration the Task may be active before the system will
+   * actively try to mark it failed and kill associated containers. This applies
+   * per attempt of a task, meaning each retry can run for the full timeout.
+   * 
+ * + * .google.protobuf.Duration timeout = 17; + * + * @return The timeout. + */ + com.google.protobuf.Duration getTimeout(); + /** + * + * + *
+   * Max allowed time duration the Task may be active before the system will
+   * actively try to mark it failed and kill associated containers. This applies
+   * per attempt of a task, meaning each retry can run for the full timeout.
+   * 
+ * + * .google.protobuf.Duration timeout = 17; + */ + com.google.protobuf.DurationOrBuilder getTimeoutOrBuilder(); + + /** + * + * + *
+   * Email address of the IAM service account associated with the Task of a
+   * Job. The service account represents the identity of the
+   * running task, and determines what permissions the task has. If
+   * not provided, the task will use the project's default service account.
+   * 
+ * + * string service_account = 18; + * + * @return The serviceAccount. + */ + java.lang.String getServiceAccount(); + /** + * + * + *
+   * Email address of the IAM service account associated with the Task of a
+   * Job. The service account represents the identity of the
+   * running task, and determines what permissions the task has. If
+   * not provided, the task will use the project's default service account.
+   * 
+ * + * string service_account = 18; + * + * @return The bytes for serviceAccount. + */ + com.google.protobuf.ByteString getServiceAccountBytes(); + + /** + * + * + *
+   * The execution environment being used to host this Task.
+   * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 20; + * + * @return The enum numeric value on the wire for executionEnvironment. + */ + int getExecutionEnvironmentValue(); + /** + * + * + *
+   * The execution environment being used to host this Task.
+   * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 20; + * + * @return The executionEnvironment. + */ + com.google.cloud.run.v2.ExecutionEnvironment getExecutionEnvironment(); + + /** + * + * + *
+   * Output only. Indicates whether the resource's reconciliation is still in progress.
+   * See comments in `Job.reconciling` for additional information on
+   * reconciliation process in Cloud Run.
+   * 
+ * + * bool reconciling = 21 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The reconciling. + */ + boolean getReconciling(); + + /** + * + * + *
+   * Output only. The Condition of this Task, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.List getConditionsList(); + /** + * + * + *
+   * Output only. The Condition of this Task, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.run.v2.Condition getConditions(int index); + /** + * + * + *
+   * Output only. The Condition of this Task, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + int getConditionsCount(); + /** + * + * + *
+   * Output only. The Condition of this Task, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.List getConditionsOrBuilderList(); + /** + * + * + *
+   * Output only. The Condition of this Task, containing its readiness status, and
+   * detailed error information in case it did not reach the desired state.
+   * 
+ * + * + * repeated .google.cloud.run.v2.Condition conditions = 22 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.run.v2.ConditionOrBuilder getConditionsOrBuilder(int index); + + /** + * + * + *
+   * Output only. The generation of this Task. See comments in `Job.reconciling`
+   * for additional information on reconciliation process in Cloud Run.
+   * 
+ * + * int64 observed_generation = 23 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The observedGeneration. + */ + long getObservedGeneration(); + + /** + * + * + *
+   * Output only. Index of the Task, unique per execution, and beginning at 0.
+   * 
+ * + * int32 index = 24 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The index. + */ + int getIndex(); + + /** + * + * + *
+   * Output only. The number of times this Task was retried.
+   * Tasks are retried when they fail up to the maxRetries limit.
+   * 
+ * + * int32 retried = 25 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The retried. + */ + int getRetried(); + + /** + * + * + *
+   * Output only. Result of the last attempt of this Task.
+   * 
+ * + * + * .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the lastAttemptResult field is set. + */ + boolean hasLastAttemptResult(); + /** + * + * + *
+   * Output only. Result of the last attempt of this Task.
+   * 
+ * + * + * .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The lastAttemptResult. + */ + com.google.cloud.run.v2.TaskAttemptResult getLastAttemptResult(); + /** + * + * + *
+   * Output only. Result of the last attempt of this Task.
+   * 
+ * + * + * .google.cloud.run.v2.TaskAttemptResult last_attempt_result = 26 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.run.v2.TaskAttemptResultOrBuilder getLastAttemptResultOrBuilder(); + + /** + * + * + *
+   * Output only. A reference to a customer managed encryption key (CMEK) to use to encrypt
+   * this container image. For more information, go to
+   * https://cloud.google.com/run/docs/securing/using-cmek
+   * 
+ * + * + * string encryption_key = 28 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The encryptionKey. + */ + java.lang.String getEncryptionKey(); + /** + * + * + *
+   * Output only. A reference to a customer managed encryption key (CMEK) to use to encrypt
+   * this container image. For more information, go to
+   * https://cloud.google.com/run/docs/securing/using-cmek
+   * 
+ * + * + * string encryption_key = 28 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for encryptionKey. + */ + com.google.protobuf.ByteString getEncryptionKeyBytes(); + + /** + * + * + *
+   * Output only. VPC Access configuration to use for this Task. For more information,
+   * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+   * 
+ * + * + * .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the vpcAccess field is set. + */ + boolean hasVpcAccess(); + /** + * + * + *
+   * Output only. VPC Access configuration to use for this Task. For more information,
+   * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+   * 
+ * + * + * .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The vpcAccess. + */ + com.google.cloud.run.v2.VpcAccess getVpcAccess(); + /** + * + * + *
+   * Output only. VPC Access configuration to use for this Task. For more information,
+   * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+   * 
+ * + * + * .google.cloud.run.v2.VpcAccess vpc_access = 29 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.run.v2.VpcAccessOrBuilder getVpcAccessOrBuilder(); + + /** + * + * + *
+   * Output only. A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * Output only. A system-generated fingerprint for this version of the
+   * resource. May be used to detect modification conflict during updates.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskProto.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskProto.java new file mode 100644 index 000000000000..2a9591ab1460 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskProto.java @@ -0,0 +1,258 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/task.proto + +package com.google.cloud.run.v2; + +public final class TaskProto { + private TaskProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_GetTaskRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_GetTaskRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_ListTasksRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_ListTasksRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_ListTasksResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_ListTasksResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_Task_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_Task_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_Task_LabelsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_Task_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_Task_AnnotationsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_Task_AnnotationsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_TaskAttemptResult_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_TaskAttemptResult_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n\036google/cloud/run/v2/task.proto\022\023google" + + ".cloud.run.v2\032\034google/api/annotations.pr" + + "oto\032\027google/api/client.proto\032\037google/api" + + "/field_behavior.proto\032\031google/api/resour" + + "ce.proto\032#google/cloud/run/v2/condition." + + "proto\032!google/cloud/run/v2/k8s.min.proto" + + "\032)google/cloud/run/v2/vendor_settings.pr" + + "oto\032\036google/protobuf/duration.proto\032\037goo" + + "gle/protobuf/timestamp.proto\032\027google/rpc" + + "/status.proto\"?\n\016GetTaskRequest\022-\n\004name\030" + + "\001 \001(\tB\037\340A\002\372A\031\n\027run.googleapis.com/Task\"\200" + + "\001\n\020ListTasksRequest\022/\n\006parent\030\001 \001(\tB\037\340A\002" + + "\372A\031\022\027run.googleapis.com/Task\022\021\n\tpage_siz" + + "e\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t\022\024\n\014show_dele" + + "ted\030\004 \001(\010\"V\n\021ListTasksResponse\022(\n\005tasks\030" + + "\001 \003(\0132\031.google.cloud.run.v2.Task\022\027\n\017next" + + "_page_token\030\002 \001(\t\"\303\013\n\004Task\022\021\n\004name\030\001 \001(\t" + + "B\003\340A\003\022\020\n\003uid\030\002 \001(\tB\003\340A\003\022\027\n\ngeneration\030\003 " + + "\001(\003B\003\340A\003\0225\n\006labels\030\004 \003(\0132%.google.cloud." + + "run.v2.Task.LabelsEntry\022?\n\013annotations\030\005" + + " \003(\0132*.google.cloud.run.v2.Task.Annotati" + + "onsEntry\0224\n\013create_time\030\006 \001(\0132\032.google.p" + + "rotobuf.TimestampB\003\340A\003\0223\n\nstart_time\030\033 \001" + + "(\0132\032.google.protobuf.TimestampB\003\340A\003\0228\n\017c" + + "ompletion_time\030\007 \001(\0132\032.google.protobuf.T" + + "imestampB\003\340A\003\0224\n\013update_time\030\010 \001(\0132\032.goo" + + "gle.protobuf.TimestampB\003\340A\003\0224\n\013delete_ti" + + "me\030\t \001(\0132\032.google.protobuf.TimestampB\003\340A" + + "\003\0224\n\013expire_time\030\n \001(\0132\032.google.protobuf" + + ".TimestampB\003\340A\003\022+\n\003job\030\014 \001(\tB\036\340A\003\372A\030\n\026ru" + + "n.googleapis.com/Job\0227\n\texecution\030\r \001(\tB" + + "$\340A\003\372A\036\n\034run.googleapis.com/Execution\0222\n" + + "\ncontainers\030\016 \003(\0132\036.google.cloud.run.v2." + + "Container\022,\n\007volumes\030\017 \003(\0132\033.google.clou" + + "d.run.v2.Volume\022\023\n\013max_retries\030\020 \001(\005\022*\n\007" + + "timeout\030\021 \001(\0132\031.google.protobuf.Duration" + + "\022\027\n\017service_account\030\022 \001(\t\022H\n\025execution_e" + + "nvironment\030\024 \001(\0162).google.cloud.run.v2.E" + + "xecutionEnvironment\022\030\n\013reconciling\030\025 \001(\010" + + "B\003\340A\003\0227\n\nconditions\030\026 \003(\0132\036.google.cloud" + + ".run.v2.ConditionB\003\340A\003\022 \n\023observed_gener" + + "ation\030\027 \001(\003B\003\340A\003\022\022\n\005index\030\030 \001(\005B\003\340A\003\022\024\n\007" + + "retried\030\031 \001(\005B\003\340A\003\022H\n\023last_attempt_resul" + + "t\030\032 \001(\0132&.google.cloud.run.v2.TaskAttemp" + + "tResultB\003\340A\003\022A\n\016encryption_key\030\034 \001(\tB)\340A" + + "\003\372A#\n!cloudkms.googleapis.com/CryptoKey\022" + + "7\n\nvpc_access\030\035 \001(\0132\036.google.cloud.run.v" + + "2.VpcAccessB\003\340A\003\022\021\n\004etag\030c \001(\tB\003\340A\003\032-\n\013L" + + "abelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\002" + + "8\001\0322\n\020AnnotationsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005v" + + "alue\030\002 \001(\t:\0028\001:w\352At\n\027run.googleapis.com/" + + "Task\022Vprojects/{project}/locations/{loca" + + "tion}/jobs/{job}/executions/{execution}/" + + "tasks/{task}R\001\001\"T\n\021TaskAttemptResult\022\'\n\006" + + "status\030\001 \001(\0132\022.google.rpc.StatusB\003\340A\003\022\026\n" + + "\texit_code\030\002 \001(\005B\003\340A\0032\226\003\n\005Tasks\022\227\001\n\007GetT" + + "ask\022#.google.cloud.run.v2.GetTaskRequest" + + "\032\031.google.cloud.run.v2.Task\"L\202\323\344\223\002?\022=/v2" + + "/{name=projects/*/locations/*/jobs/*/exe" + + "cutions/*/tasks/*}\332A\004name\022\252\001\n\tListTasks\022" + + "%.google.cloud.run.v2.ListTasksRequest\032&" + + ".google.cloud.run.v2.ListTasksResponse\"N" + + "\202\323\344\223\002?\022=/v2/{parent=projects/*/locations" + + "/*/jobs/*/executions/*}/tasks\332A\006parent\032F" + + "\312A\022run.googleapis.com\322A.https://www.goog" + + "leapis.com/auth/cloud-platformB^\n\027com.go" + + "ogle.cloud.run.v2B\tTaskProtoP\001Z6google.g" + + "olang.org/genproto/googleapis/cloud/run/" + + "v2;runb\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.cloud.run.v2.ConditionProto.getDescriptor(), + com.google.cloud.run.v2.K8sMinProto.getDescriptor(), + com.google.cloud.run.v2.VendorSettingsProto.getDescriptor(), + com.google.protobuf.DurationProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + com.google.rpc.StatusProto.getDescriptor(), + }); + internal_static_google_cloud_run_v2_GetTaskRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_run_v2_GetTaskRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_GetTaskRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_run_v2_ListTasksRequest_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_run_v2_ListTasksRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_ListTasksRequest_descriptor, + new java.lang.String[] { + "Parent", "PageSize", "PageToken", "ShowDeleted", + }); + internal_static_google_cloud_run_v2_ListTasksResponse_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_run_v2_ListTasksResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_ListTasksResponse_descriptor, + new java.lang.String[] { + "Tasks", "NextPageToken", + }); + internal_static_google_cloud_run_v2_Task_descriptor = getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_run_v2_Task_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_Task_descriptor, + new java.lang.String[] { + "Name", + "Uid", + "Generation", + "Labels", + "Annotations", + "CreateTime", + "StartTime", + "CompletionTime", + "UpdateTime", + "DeleteTime", + "ExpireTime", + "Job", + "Execution", + "Containers", + "Volumes", + "MaxRetries", + "Timeout", + "ServiceAccount", + "ExecutionEnvironment", + "Reconciling", + "Conditions", + "ObservedGeneration", + "Index", + "Retried", + "LastAttemptResult", + "EncryptionKey", + "VpcAccess", + "Etag", + }); + internal_static_google_cloud_run_v2_Task_LabelsEntry_descriptor = + internal_static_google_cloud_run_v2_Task_descriptor.getNestedTypes().get(0); + internal_static_google_cloud_run_v2_Task_LabelsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_Task_LabelsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_cloud_run_v2_Task_AnnotationsEntry_descriptor = + internal_static_google_cloud_run_v2_Task_descriptor.getNestedTypes().get(1); + internal_static_google_cloud_run_v2_Task_AnnotationsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_Task_AnnotationsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_cloud_run_v2_TaskAttemptResult_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_run_v2_TaskAttemptResult_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_TaskAttemptResult_descriptor, + new java.lang.String[] { + "Status", "ExitCode", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.methodSignature); + registry.add(com.google.api.ClientProto.oauthScopes); + registry.add(com.google.api.ResourceProto.resource); + registry.add(com.google.api.ResourceProto.resourceReference); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.cloud.run.v2.ConditionProto.getDescriptor(); + com.google.cloud.run.v2.K8sMinProto.getDescriptor(); + com.google.cloud.run.v2.VendorSettingsProto.getDescriptor(); + com.google.protobuf.DurationProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + com.google.rpc.StatusProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskTemplate.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskTemplate.java new file mode 100644 index 000000000000..06fef4dea4ce --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskTemplate.java @@ -0,0 +1,2741 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/task_template.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * TaskTemplate describes the data a task should have when created
+ * from a template.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.TaskTemplate} + */ +public final class TaskTemplate extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.TaskTemplate) + TaskTemplateOrBuilder { + private static final long serialVersionUID = 0L; + // Use TaskTemplate.newBuilder() to construct. + private TaskTemplate(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private TaskTemplate() { + containers_ = java.util.Collections.emptyList(); + volumes_ = java.util.Collections.emptyList(); + serviceAccount_ = ""; + executionEnvironment_ = 0; + encryptionKey_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new TaskTemplate(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.TaskTemplateProto + .internal_static_google_cloud_run_v2_TaskTemplate_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.TaskTemplateProto + .internal_static_google_cloud_run_v2_TaskTemplate_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.TaskTemplate.class, + com.google.cloud.run.v2.TaskTemplate.Builder.class); + } + + private int retriesCase_ = 0; + private java.lang.Object retries_; + + public enum RetriesCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + MAX_RETRIES(3), + RETRIES_NOT_SET(0); + private final int value; + + private RetriesCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static RetriesCase valueOf(int value) { + return forNumber(value); + } + + public static RetriesCase forNumber(int value) { + switch (value) { + case 3: + return MAX_RETRIES; + case 0: + return RETRIES_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public RetriesCase getRetriesCase() { + return RetriesCase.forNumber(retriesCase_); + } + + public static final int CONTAINERS_FIELD_NUMBER = 1; + private java.util.List containers_; + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + @java.lang.Override + public java.util.List getContainersList() { + return containers_; + } + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + @java.lang.Override + public java.util.List + getContainersOrBuilderList() { + return containers_; + } + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + @java.lang.Override + public int getContainersCount() { + return containers_.size(); + } + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + @java.lang.Override + public com.google.cloud.run.v2.Container getContainers(int index) { + return containers_.get(index); + } + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + @java.lang.Override + public com.google.cloud.run.v2.ContainerOrBuilder getContainersOrBuilder(int index) { + return containers_.get(index); + } + + public static final int VOLUMES_FIELD_NUMBER = 2; + private java.util.List volumes_; + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + @java.lang.Override + public java.util.List getVolumesList() { + return volumes_; + } + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + @java.lang.Override + public java.util.List + getVolumesOrBuilderList() { + return volumes_; + } + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + @java.lang.Override + public int getVolumesCount() { + return volumes_.size(); + } + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + @java.lang.Override + public com.google.cloud.run.v2.Volume getVolumes(int index) { + return volumes_.get(index); + } + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + @java.lang.Override + public com.google.cloud.run.v2.VolumeOrBuilder getVolumesOrBuilder(int index) { + return volumes_.get(index); + } + + public static final int MAX_RETRIES_FIELD_NUMBER = 3; + /** + * + * + *
+   * Number of retries allowed per Task, before marking this Task failed.
+   * 
+ * + * int32 max_retries = 3; + * + * @return Whether the maxRetries field is set. + */ + @java.lang.Override + public boolean hasMaxRetries() { + return retriesCase_ == 3; + } + /** + * + * + *
+   * Number of retries allowed per Task, before marking this Task failed.
+   * 
+ * + * int32 max_retries = 3; + * + * @return The maxRetries. + */ + @java.lang.Override + public int getMaxRetries() { + if (retriesCase_ == 3) { + return (java.lang.Integer) retries_; + } + return 0; + } + + public static final int TIMEOUT_FIELD_NUMBER = 4; + private com.google.protobuf.Duration timeout_; + /** + * + * + *
+   * Max allowed time duration the Task may be active before the system will
+   * actively try to mark it failed and kill associated containers. This applies
+   * per attempt of a task, meaning each retry can run for the full timeout.
+   * 
+ * + * .google.protobuf.Duration timeout = 4; + * + * @return Whether the timeout field is set. + */ + @java.lang.Override + public boolean hasTimeout() { + return timeout_ != null; + } + /** + * + * + *
+   * Max allowed time duration the Task may be active before the system will
+   * actively try to mark it failed and kill associated containers. This applies
+   * per attempt of a task, meaning each retry can run for the full timeout.
+   * 
+ * + * .google.protobuf.Duration timeout = 4; + * + * @return The timeout. + */ + @java.lang.Override + public com.google.protobuf.Duration getTimeout() { + return timeout_ == null ? com.google.protobuf.Duration.getDefaultInstance() : timeout_; + } + /** + * + * + *
+   * Max allowed time duration the Task may be active before the system will
+   * actively try to mark it failed and kill associated containers. This applies
+   * per attempt of a task, meaning each retry can run for the full timeout.
+   * 
+ * + * .google.protobuf.Duration timeout = 4; + */ + @java.lang.Override + public com.google.protobuf.DurationOrBuilder getTimeoutOrBuilder() { + return getTimeout(); + } + + public static final int SERVICE_ACCOUNT_FIELD_NUMBER = 5; + private volatile java.lang.Object serviceAccount_; + /** + * + * + *
+   * Email address of the IAM service account associated with the Task of a
+   * Job. The service account represents the identity of the
+   * running task, and determines what permissions the task has. If
+   * not provided, the task will use the project's default service account.
+   * 
+ * + * string service_account = 5; + * + * @return The serviceAccount. + */ + @java.lang.Override + public java.lang.String getServiceAccount() { + java.lang.Object ref = serviceAccount_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceAccount_ = s; + return s; + } + } + /** + * + * + *
+   * Email address of the IAM service account associated with the Task of a
+   * Job. The service account represents the identity of the
+   * running task, and determines what permissions the task has. If
+   * not provided, the task will use the project's default service account.
+   * 
+ * + * string service_account = 5; + * + * @return The bytes for serviceAccount. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServiceAccountBytes() { + java.lang.Object ref = serviceAccount_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceAccount_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int EXECUTION_ENVIRONMENT_FIELD_NUMBER = 6; + private int executionEnvironment_; + /** + * + * + *
+   * The execution environment being used to host this Task.
+   * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 6; + * + * @return The enum numeric value on the wire for executionEnvironment. + */ + @java.lang.Override + public int getExecutionEnvironmentValue() { + return executionEnvironment_; + } + /** + * + * + *
+   * The execution environment being used to host this Task.
+   * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 6; + * + * @return The executionEnvironment. + */ + @java.lang.Override + public com.google.cloud.run.v2.ExecutionEnvironment getExecutionEnvironment() { + @SuppressWarnings("deprecation") + com.google.cloud.run.v2.ExecutionEnvironment result = + com.google.cloud.run.v2.ExecutionEnvironment.valueOf(executionEnvironment_); + return result == null ? com.google.cloud.run.v2.ExecutionEnvironment.UNRECOGNIZED : result; + } + + public static final int ENCRYPTION_KEY_FIELD_NUMBER = 7; + private volatile java.lang.Object encryptionKey_; + /** + * + * + *
+   * A reference to a customer managed encryption key (CMEK) to use to encrypt
+   * this container image. For more information, go to
+   * https://cloud.google.com/run/docs/securing/using-cmek
+   * 
+ * + * string encryption_key = 7 [(.google.api.resource_reference) = { ... } + * + * @return The encryptionKey. + */ + @java.lang.Override + public java.lang.String getEncryptionKey() { + java.lang.Object ref = encryptionKey_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + encryptionKey_ = s; + return s; + } + } + /** + * + * + *
+   * A reference to a customer managed encryption key (CMEK) to use to encrypt
+   * this container image. For more information, go to
+   * https://cloud.google.com/run/docs/securing/using-cmek
+   * 
+ * + * string encryption_key = 7 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for encryptionKey. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEncryptionKeyBytes() { + java.lang.Object ref = encryptionKey_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + encryptionKey_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VPC_ACCESS_FIELD_NUMBER = 8; + private com.google.cloud.run.v2.VpcAccess vpcAccess_; + /** + * + * + *
+   * VPC Access configuration to use for this Task. For more information,
+   * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+   * 
+ * + * .google.cloud.run.v2.VpcAccess vpc_access = 8; + * + * @return Whether the vpcAccess field is set. + */ + @java.lang.Override + public boolean hasVpcAccess() { + return vpcAccess_ != null; + } + /** + * + * + *
+   * VPC Access configuration to use for this Task. For more information,
+   * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+   * 
+ * + * .google.cloud.run.v2.VpcAccess vpc_access = 8; + * + * @return The vpcAccess. + */ + @java.lang.Override + public com.google.cloud.run.v2.VpcAccess getVpcAccess() { + return vpcAccess_ == null ? com.google.cloud.run.v2.VpcAccess.getDefaultInstance() : vpcAccess_; + } + /** + * + * + *
+   * VPC Access configuration to use for this Task. For more information,
+   * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+   * 
+ * + * .google.cloud.run.v2.VpcAccess vpc_access = 8; + */ + @java.lang.Override + public com.google.cloud.run.v2.VpcAccessOrBuilder getVpcAccessOrBuilder() { + return getVpcAccess(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < containers_.size(); i++) { + output.writeMessage(1, containers_.get(i)); + } + for (int i = 0; i < volumes_.size(); i++) { + output.writeMessage(2, volumes_.get(i)); + } + if (retriesCase_ == 3) { + output.writeInt32(3, (int) ((java.lang.Integer) retries_)); + } + if (timeout_ != null) { + output.writeMessage(4, getTimeout()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceAccount_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, serviceAccount_); + } + if (executionEnvironment_ + != com.google.cloud.run.v2.ExecutionEnvironment.EXECUTION_ENVIRONMENT_UNSPECIFIED + .getNumber()) { + output.writeEnum(6, executionEnvironment_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(encryptionKey_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, encryptionKey_); + } + if (vpcAccess_ != null) { + output.writeMessage(8, getVpcAccess()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < containers_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, containers_.get(i)); + } + for (int i = 0; i < volumes_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, volumes_.get(i)); + } + if (retriesCase_ == 3) { + size += + com.google.protobuf.CodedOutputStream.computeInt32Size( + 3, (int) ((java.lang.Integer) retries_)); + } + if (timeout_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getTimeout()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serviceAccount_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, serviceAccount_); + } + if (executionEnvironment_ + != com.google.cloud.run.v2.ExecutionEnvironment.EXECUTION_ENVIRONMENT_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(6, executionEnvironment_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(encryptionKey_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, encryptionKey_); + } + if (vpcAccess_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getVpcAccess()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.TaskTemplate)) { + return super.equals(obj); + } + com.google.cloud.run.v2.TaskTemplate other = (com.google.cloud.run.v2.TaskTemplate) obj; + + if (!getContainersList().equals(other.getContainersList())) return false; + if (!getVolumesList().equals(other.getVolumesList())) return false; + if (hasTimeout() != other.hasTimeout()) return false; + if (hasTimeout()) { + if (!getTimeout().equals(other.getTimeout())) return false; + } + if (!getServiceAccount().equals(other.getServiceAccount())) return false; + if (executionEnvironment_ != other.executionEnvironment_) return false; + if (!getEncryptionKey().equals(other.getEncryptionKey())) return false; + if (hasVpcAccess() != other.hasVpcAccess()) return false; + if (hasVpcAccess()) { + if (!getVpcAccess().equals(other.getVpcAccess())) return false; + } + if (!getRetriesCase().equals(other.getRetriesCase())) return false; + switch (retriesCase_) { + case 3: + if (getMaxRetries() != other.getMaxRetries()) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getContainersCount() > 0) { + hash = (37 * hash) + CONTAINERS_FIELD_NUMBER; + hash = (53 * hash) + getContainersList().hashCode(); + } + if (getVolumesCount() > 0) { + hash = (37 * hash) + VOLUMES_FIELD_NUMBER; + hash = (53 * hash) + getVolumesList().hashCode(); + } + if (hasTimeout()) { + hash = (37 * hash) + TIMEOUT_FIELD_NUMBER; + hash = (53 * hash) + getTimeout().hashCode(); + } + hash = (37 * hash) + SERVICE_ACCOUNT_FIELD_NUMBER; + hash = (53 * hash) + getServiceAccount().hashCode(); + hash = (37 * hash) + EXECUTION_ENVIRONMENT_FIELD_NUMBER; + hash = (53 * hash) + executionEnvironment_; + hash = (37 * hash) + ENCRYPTION_KEY_FIELD_NUMBER; + hash = (53 * hash) + getEncryptionKey().hashCode(); + if (hasVpcAccess()) { + hash = (37 * hash) + VPC_ACCESS_FIELD_NUMBER; + hash = (53 * hash) + getVpcAccess().hashCode(); + } + switch (retriesCase_) { + case 3: + hash = (37 * hash) + MAX_RETRIES_FIELD_NUMBER; + hash = (53 * hash) + getMaxRetries(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.TaskTemplate parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.TaskTemplate parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.TaskTemplate parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.TaskTemplate parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.TaskTemplate parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.TaskTemplate parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.TaskTemplate parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.TaskTemplate parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.TaskTemplate parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.TaskTemplate parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.TaskTemplate parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.TaskTemplate parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.TaskTemplate prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * TaskTemplate describes the data a task should have when created
+   * from a template.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.TaskTemplate} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.TaskTemplate) + com.google.cloud.run.v2.TaskTemplateOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.TaskTemplateProto + .internal_static_google_cloud_run_v2_TaskTemplate_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.TaskTemplateProto + .internal_static_google_cloud_run_v2_TaskTemplate_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.TaskTemplate.class, + com.google.cloud.run.v2.TaskTemplate.Builder.class); + } + + // Construct using com.google.cloud.run.v2.TaskTemplate.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (containersBuilder_ == null) { + containers_ = java.util.Collections.emptyList(); + } else { + containers_ = null; + containersBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + if (volumesBuilder_ == null) { + volumes_ = java.util.Collections.emptyList(); + } else { + volumes_ = null; + volumesBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + if (timeoutBuilder_ == null) { + timeout_ = null; + } else { + timeout_ = null; + timeoutBuilder_ = null; + } + serviceAccount_ = ""; + + executionEnvironment_ = 0; + + encryptionKey_ = ""; + + if (vpcAccessBuilder_ == null) { + vpcAccess_ = null; + } else { + vpcAccess_ = null; + vpcAccessBuilder_ = null; + } + retriesCase_ = 0; + retries_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.TaskTemplateProto + .internal_static_google_cloud_run_v2_TaskTemplate_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.TaskTemplate getDefaultInstanceForType() { + return com.google.cloud.run.v2.TaskTemplate.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.TaskTemplate build() { + com.google.cloud.run.v2.TaskTemplate result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.TaskTemplate buildPartial() { + com.google.cloud.run.v2.TaskTemplate result = new com.google.cloud.run.v2.TaskTemplate(this); + int from_bitField0_ = bitField0_; + if (containersBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + containers_ = java.util.Collections.unmodifiableList(containers_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.containers_ = containers_; + } else { + result.containers_ = containersBuilder_.build(); + } + if (volumesBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + volumes_ = java.util.Collections.unmodifiableList(volumes_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.volumes_ = volumes_; + } else { + result.volumes_ = volumesBuilder_.build(); + } + if (retriesCase_ == 3) { + result.retries_ = retries_; + } + if (timeoutBuilder_ == null) { + result.timeout_ = timeout_; + } else { + result.timeout_ = timeoutBuilder_.build(); + } + result.serviceAccount_ = serviceAccount_; + result.executionEnvironment_ = executionEnvironment_; + result.encryptionKey_ = encryptionKey_; + if (vpcAccessBuilder_ == null) { + result.vpcAccess_ = vpcAccess_; + } else { + result.vpcAccess_ = vpcAccessBuilder_.build(); + } + result.retriesCase_ = retriesCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.TaskTemplate) { + return mergeFrom((com.google.cloud.run.v2.TaskTemplate) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.TaskTemplate other) { + if (other == com.google.cloud.run.v2.TaskTemplate.getDefaultInstance()) return this; + if (containersBuilder_ == null) { + if (!other.containers_.isEmpty()) { + if (containers_.isEmpty()) { + containers_ = other.containers_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureContainersIsMutable(); + containers_.addAll(other.containers_); + } + onChanged(); + } + } else { + if (!other.containers_.isEmpty()) { + if (containersBuilder_.isEmpty()) { + containersBuilder_.dispose(); + containersBuilder_ = null; + containers_ = other.containers_; + bitField0_ = (bitField0_ & ~0x00000001); + containersBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getContainersFieldBuilder() + : null; + } else { + containersBuilder_.addAllMessages(other.containers_); + } + } + } + if (volumesBuilder_ == null) { + if (!other.volumes_.isEmpty()) { + if (volumes_.isEmpty()) { + volumes_ = other.volumes_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureVolumesIsMutable(); + volumes_.addAll(other.volumes_); + } + onChanged(); + } + } else { + if (!other.volumes_.isEmpty()) { + if (volumesBuilder_.isEmpty()) { + volumesBuilder_.dispose(); + volumesBuilder_ = null; + volumes_ = other.volumes_; + bitField0_ = (bitField0_ & ~0x00000002); + volumesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getVolumesFieldBuilder() + : null; + } else { + volumesBuilder_.addAllMessages(other.volumes_); + } + } + } + if (other.hasTimeout()) { + mergeTimeout(other.getTimeout()); + } + if (!other.getServiceAccount().isEmpty()) { + serviceAccount_ = other.serviceAccount_; + onChanged(); + } + if (other.executionEnvironment_ != 0) { + setExecutionEnvironmentValue(other.getExecutionEnvironmentValue()); + } + if (!other.getEncryptionKey().isEmpty()) { + encryptionKey_ = other.encryptionKey_; + onChanged(); + } + if (other.hasVpcAccess()) { + mergeVpcAccess(other.getVpcAccess()); + } + switch (other.getRetriesCase()) { + case MAX_RETRIES: + { + setMaxRetries(other.getMaxRetries()); + break; + } + case RETRIES_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.run.v2.Container m = + input.readMessage( + com.google.cloud.run.v2.Container.parser(), extensionRegistry); + if (containersBuilder_ == null) { + ensureContainersIsMutable(); + containers_.add(m); + } else { + containersBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + com.google.cloud.run.v2.Volume m = + input.readMessage(com.google.cloud.run.v2.Volume.parser(), extensionRegistry); + if (volumesBuilder_ == null) { + ensureVolumesIsMutable(); + volumes_.add(m); + } else { + volumesBuilder_.addMessage(m); + } + break; + } // case 18 + case 24: + { + retries_ = input.readInt32(); + retriesCase_ = 3; + break; + } // case 24 + case 34: + { + input.readMessage(getTimeoutFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 34 + case 42: + { + serviceAccount_ = input.readStringRequireUtf8(); + + break; + } // case 42 + case 48: + { + executionEnvironment_ = input.readEnum(); + + break; + } // case 48 + case 58: + { + encryptionKey_ = input.readStringRequireUtf8(); + + break; + } // case 58 + case 66: + { + input.readMessage(getVpcAccessFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 66 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int retriesCase_ = 0; + private java.lang.Object retries_; + + public RetriesCase getRetriesCase() { + return RetriesCase.forNumber(retriesCase_); + } + + public Builder clearRetries() { + retriesCase_ = 0; + retries_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private java.util.List containers_ = + java.util.Collections.emptyList(); + + private void ensureContainersIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + containers_ = new java.util.ArrayList(containers_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Container, + com.google.cloud.run.v2.Container.Builder, + com.google.cloud.run.v2.ContainerOrBuilder> + containersBuilder_; + + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public java.util.List getContainersList() { + if (containersBuilder_ == null) { + return java.util.Collections.unmodifiableList(containers_); + } else { + return containersBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public int getContainersCount() { + if (containersBuilder_ == null) { + return containers_.size(); + } else { + return containersBuilder_.getCount(); + } + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public com.google.cloud.run.v2.Container getContainers(int index) { + if (containersBuilder_ == null) { + return containers_.get(index); + } else { + return containersBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public Builder setContainers(int index, com.google.cloud.run.v2.Container value) { + if (containersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContainersIsMutable(); + containers_.set(index, value); + onChanged(); + } else { + containersBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public Builder setContainers( + int index, com.google.cloud.run.v2.Container.Builder builderForValue) { + if (containersBuilder_ == null) { + ensureContainersIsMutable(); + containers_.set(index, builderForValue.build()); + onChanged(); + } else { + containersBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public Builder addContainers(com.google.cloud.run.v2.Container value) { + if (containersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContainersIsMutable(); + containers_.add(value); + onChanged(); + } else { + containersBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public Builder addContainers(int index, com.google.cloud.run.v2.Container value) { + if (containersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContainersIsMutable(); + containers_.add(index, value); + onChanged(); + } else { + containersBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public Builder addContainers(com.google.cloud.run.v2.Container.Builder builderForValue) { + if (containersBuilder_ == null) { + ensureContainersIsMutable(); + containers_.add(builderForValue.build()); + onChanged(); + } else { + containersBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public Builder addContainers( + int index, com.google.cloud.run.v2.Container.Builder builderForValue) { + if (containersBuilder_ == null) { + ensureContainersIsMutable(); + containers_.add(index, builderForValue.build()); + onChanged(); + } else { + containersBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public Builder addAllContainers( + java.lang.Iterable values) { + if (containersBuilder_ == null) { + ensureContainersIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, containers_); + onChanged(); + } else { + containersBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public Builder clearContainers() { + if (containersBuilder_ == null) { + containers_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + containersBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public Builder removeContainers(int index) { + if (containersBuilder_ == null) { + ensureContainersIsMutable(); + containers_.remove(index); + onChanged(); + } else { + containersBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public com.google.cloud.run.v2.Container.Builder getContainersBuilder(int index) { + return getContainersFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public com.google.cloud.run.v2.ContainerOrBuilder getContainersOrBuilder(int index) { + if (containersBuilder_ == null) { + return containers_.get(index); + } else { + return containersBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public java.util.List + getContainersOrBuilderList() { + if (containersBuilder_ != null) { + return containersBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(containers_); + } + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public com.google.cloud.run.v2.Container.Builder addContainersBuilder() { + return getContainersFieldBuilder() + .addBuilder(com.google.cloud.run.v2.Container.getDefaultInstance()); + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public com.google.cloud.run.v2.Container.Builder addContainersBuilder(int index) { + return getContainersFieldBuilder() + .addBuilder(index, com.google.cloud.run.v2.Container.getDefaultInstance()); + } + /** + * + * + *
+     * Holds the single container that defines the unit of execution for this
+     * task.
+     * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + public java.util.List getContainersBuilderList() { + return getContainersFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Container, + com.google.cloud.run.v2.Container.Builder, + com.google.cloud.run.v2.ContainerOrBuilder> + getContainersFieldBuilder() { + if (containersBuilder_ == null) { + containersBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Container, + com.google.cloud.run.v2.Container.Builder, + com.google.cloud.run.v2.ContainerOrBuilder>( + containers_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + containers_ = null; + } + return containersBuilder_; + } + + private java.util.List volumes_ = + java.util.Collections.emptyList(); + + private void ensureVolumesIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + volumes_ = new java.util.ArrayList(volumes_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Volume, + com.google.cloud.run.v2.Volume.Builder, + com.google.cloud.run.v2.VolumeOrBuilder> + volumesBuilder_; + + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public java.util.List getVolumesList() { + if (volumesBuilder_ == null) { + return java.util.Collections.unmodifiableList(volumes_); + } else { + return volumesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public int getVolumesCount() { + if (volumesBuilder_ == null) { + return volumes_.size(); + } else { + return volumesBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public com.google.cloud.run.v2.Volume getVolumes(int index) { + if (volumesBuilder_ == null) { + return volumes_.get(index); + } else { + return volumesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public Builder setVolumes(int index, com.google.cloud.run.v2.Volume value) { + if (volumesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureVolumesIsMutable(); + volumes_.set(index, value); + onChanged(); + } else { + volumesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public Builder setVolumes(int index, com.google.cloud.run.v2.Volume.Builder builderForValue) { + if (volumesBuilder_ == null) { + ensureVolumesIsMutable(); + volumes_.set(index, builderForValue.build()); + onChanged(); + } else { + volumesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public Builder addVolumes(com.google.cloud.run.v2.Volume value) { + if (volumesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureVolumesIsMutable(); + volumes_.add(value); + onChanged(); + } else { + volumesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public Builder addVolumes(int index, com.google.cloud.run.v2.Volume value) { + if (volumesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureVolumesIsMutable(); + volumes_.add(index, value); + onChanged(); + } else { + volumesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public Builder addVolumes(com.google.cloud.run.v2.Volume.Builder builderForValue) { + if (volumesBuilder_ == null) { + ensureVolumesIsMutable(); + volumes_.add(builderForValue.build()); + onChanged(); + } else { + volumesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public Builder addVolumes(int index, com.google.cloud.run.v2.Volume.Builder builderForValue) { + if (volumesBuilder_ == null) { + ensureVolumesIsMutable(); + volumes_.add(index, builderForValue.build()); + onChanged(); + } else { + volumesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public Builder addAllVolumes( + java.lang.Iterable values) { + if (volumesBuilder_ == null) { + ensureVolumesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, volumes_); + onChanged(); + } else { + volumesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public Builder clearVolumes() { + if (volumesBuilder_ == null) { + volumes_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + volumesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public Builder removeVolumes(int index) { + if (volumesBuilder_ == null) { + ensureVolumesIsMutable(); + volumes_.remove(index); + onChanged(); + } else { + volumesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public com.google.cloud.run.v2.Volume.Builder getVolumesBuilder(int index) { + return getVolumesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public com.google.cloud.run.v2.VolumeOrBuilder getVolumesOrBuilder(int index) { + if (volumesBuilder_ == null) { + return volumes_.get(index); + } else { + return volumesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public java.util.List + getVolumesOrBuilderList() { + if (volumesBuilder_ != null) { + return volumesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(volumes_); + } + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public com.google.cloud.run.v2.Volume.Builder addVolumesBuilder() { + return getVolumesFieldBuilder() + .addBuilder(com.google.cloud.run.v2.Volume.getDefaultInstance()); + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public com.google.cloud.run.v2.Volume.Builder addVolumesBuilder(int index) { + return getVolumesFieldBuilder() + .addBuilder(index, com.google.cloud.run.v2.Volume.getDefaultInstance()); + } + /** + * + * + *
+     * A list of Volumes to make available to containers.
+     * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + public java.util.List getVolumesBuilderList() { + return getVolumesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Volume, + com.google.cloud.run.v2.Volume.Builder, + com.google.cloud.run.v2.VolumeOrBuilder> + getVolumesFieldBuilder() { + if (volumesBuilder_ == null) { + volumesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.run.v2.Volume, + com.google.cloud.run.v2.Volume.Builder, + com.google.cloud.run.v2.VolumeOrBuilder>( + volumes_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); + volumes_ = null; + } + return volumesBuilder_; + } + + /** + * + * + *
+     * Number of retries allowed per Task, before marking this Task failed.
+     * 
+ * + * int32 max_retries = 3; + * + * @return Whether the maxRetries field is set. + */ + public boolean hasMaxRetries() { + return retriesCase_ == 3; + } + /** + * + * + *
+     * Number of retries allowed per Task, before marking this Task failed.
+     * 
+ * + * int32 max_retries = 3; + * + * @return The maxRetries. + */ + public int getMaxRetries() { + if (retriesCase_ == 3) { + return (java.lang.Integer) retries_; + } + return 0; + } + /** + * + * + *
+     * Number of retries allowed per Task, before marking this Task failed.
+     * 
+ * + * int32 max_retries = 3; + * + * @param value The maxRetries to set. + * @return This builder for chaining. + */ + public Builder setMaxRetries(int value) { + retriesCase_ = 3; + retries_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Number of retries allowed per Task, before marking this Task failed.
+     * 
+ * + * int32 max_retries = 3; + * + * @return This builder for chaining. + */ + public Builder clearMaxRetries() { + if (retriesCase_ == 3) { + retriesCase_ = 0; + retries_ = null; + onChanged(); + } + return this; + } + + private com.google.protobuf.Duration timeout_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + timeoutBuilder_; + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 4; + * + * @return Whether the timeout field is set. + */ + public boolean hasTimeout() { + return timeoutBuilder_ != null || timeout_ != null; + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 4; + * + * @return The timeout. + */ + public com.google.protobuf.Duration getTimeout() { + if (timeoutBuilder_ == null) { + return timeout_ == null ? com.google.protobuf.Duration.getDefaultInstance() : timeout_; + } else { + return timeoutBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 4; + */ + public Builder setTimeout(com.google.protobuf.Duration value) { + if (timeoutBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + timeout_ = value; + onChanged(); + } else { + timeoutBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 4; + */ + public Builder setTimeout(com.google.protobuf.Duration.Builder builderForValue) { + if (timeoutBuilder_ == null) { + timeout_ = builderForValue.build(); + onChanged(); + } else { + timeoutBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 4; + */ + public Builder mergeTimeout(com.google.protobuf.Duration value) { + if (timeoutBuilder_ == null) { + if (timeout_ != null) { + timeout_ = + com.google.protobuf.Duration.newBuilder(timeout_).mergeFrom(value).buildPartial(); + } else { + timeout_ = value; + } + onChanged(); + } else { + timeoutBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 4; + */ + public Builder clearTimeout() { + if (timeoutBuilder_ == null) { + timeout_ = null; + onChanged(); + } else { + timeout_ = null; + timeoutBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 4; + */ + public com.google.protobuf.Duration.Builder getTimeoutBuilder() { + + onChanged(); + return getTimeoutFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 4; + */ + public com.google.protobuf.DurationOrBuilder getTimeoutOrBuilder() { + if (timeoutBuilder_ != null) { + return timeoutBuilder_.getMessageOrBuilder(); + } else { + return timeout_ == null ? com.google.protobuf.Duration.getDefaultInstance() : timeout_; + } + } + /** + * + * + *
+     * Max allowed time duration the Task may be active before the system will
+     * actively try to mark it failed and kill associated containers. This applies
+     * per attempt of a task, meaning each retry can run for the full timeout.
+     * 
+ * + * .google.protobuf.Duration timeout = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder> + getTimeoutFieldBuilder() { + if (timeoutBuilder_ == null) { + timeoutBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Duration, + com.google.protobuf.Duration.Builder, + com.google.protobuf.DurationOrBuilder>( + getTimeout(), getParentForChildren(), isClean()); + timeout_ = null; + } + return timeoutBuilder_; + } + + private java.lang.Object serviceAccount_ = ""; + /** + * + * + *
+     * Email address of the IAM service account associated with the Task of a
+     * Job. The service account represents the identity of the
+     * running task, and determines what permissions the task has. If
+     * not provided, the task will use the project's default service account.
+     * 
+ * + * string service_account = 5; + * + * @return The serviceAccount. + */ + public java.lang.String getServiceAccount() { + java.lang.Object ref = serviceAccount_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceAccount_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Email address of the IAM service account associated with the Task of a
+     * Job. The service account represents the identity of the
+     * running task, and determines what permissions the task has. If
+     * not provided, the task will use the project's default service account.
+     * 
+ * + * string service_account = 5; + * + * @return The bytes for serviceAccount. + */ + public com.google.protobuf.ByteString getServiceAccountBytes() { + java.lang.Object ref = serviceAccount_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceAccount_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Email address of the IAM service account associated with the Task of a
+     * Job. The service account represents the identity of the
+     * running task, and determines what permissions the task has. If
+     * not provided, the task will use the project's default service account.
+     * 
+ * + * string service_account = 5; + * + * @param value The serviceAccount to set. + * @return This builder for chaining. + */ + public Builder setServiceAccount(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + serviceAccount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Email address of the IAM service account associated with the Task of a
+     * Job. The service account represents the identity of the
+     * running task, and determines what permissions the task has. If
+     * not provided, the task will use the project's default service account.
+     * 
+ * + * string service_account = 5; + * + * @return This builder for chaining. + */ + public Builder clearServiceAccount() { + + serviceAccount_ = getDefaultInstance().getServiceAccount(); + onChanged(); + return this; + } + /** + * + * + *
+     * Email address of the IAM service account associated with the Task of a
+     * Job. The service account represents the identity of the
+     * running task, and determines what permissions the task has. If
+     * not provided, the task will use the project's default service account.
+     * 
+ * + * string service_account = 5; + * + * @param value The bytes for serviceAccount to set. + * @return This builder for chaining. + */ + public Builder setServiceAccountBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + serviceAccount_ = value; + onChanged(); + return this; + } + + private int executionEnvironment_ = 0; + /** + * + * + *
+     * The execution environment being used to host this Task.
+     * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 6; + * + * @return The enum numeric value on the wire for executionEnvironment. + */ + @java.lang.Override + public int getExecutionEnvironmentValue() { + return executionEnvironment_; + } + /** + * + * + *
+     * The execution environment being used to host this Task.
+     * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 6; + * + * @param value The enum numeric value on the wire for executionEnvironment to set. + * @return This builder for chaining. + */ + public Builder setExecutionEnvironmentValue(int value) { + + executionEnvironment_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The execution environment being used to host this Task.
+     * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 6; + * + * @return The executionEnvironment. + */ + @java.lang.Override + public com.google.cloud.run.v2.ExecutionEnvironment getExecutionEnvironment() { + @SuppressWarnings("deprecation") + com.google.cloud.run.v2.ExecutionEnvironment result = + com.google.cloud.run.v2.ExecutionEnvironment.valueOf(executionEnvironment_); + return result == null ? com.google.cloud.run.v2.ExecutionEnvironment.UNRECOGNIZED : result; + } + /** + * + * + *
+     * The execution environment being used to host this Task.
+     * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 6; + * + * @param value The executionEnvironment to set. + * @return This builder for chaining. + */ + public Builder setExecutionEnvironment(com.google.cloud.run.v2.ExecutionEnvironment value) { + if (value == null) { + throw new NullPointerException(); + } + + executionEnvironment_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The execution environment being used to host this Task.
+     * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 6; + * + * @return This builder for chaining. + */ + public Builder clearExecutionEnvironment() { + + executionEnvironment_ = 0; + onChanged(); + return this; + } + + private java.lang.Object encryptionKey_ = ""; + /** + * + * + *
+     * A reference to a customer managed encryption key (CMEK) to use to encrypt
+     * this container image. For more information, go to
+     * https://cloud.google.com/run/docs/securing/using-cmek
+     * 
+ * + * string encryption_key = 7 [(.google.api.resource_reference) = { ... } + * + * @return The encryptionKey. + */ + public java.lang.String getEncryptionKey() { + java.lang.Object ref = encryptionKey_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + encryptionKey_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A reference to a customer managed encryption key (CMEK) to use to encrypt
+     * this container image. For more information, go to
+     * https://cloud.google.com/run/docs/securing/using-cmek
+     * 
+ * + * string encryption_key = 7 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for encryptionKey. + */ + public com.google.protobuf.ByteString getEncryptionKeyBytes() { + java.lang.Object ref = encryptionKey_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + encryptionKey_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A reference to a customer managed encryption key (CMEK) to use to encrypt
+     * this container image. For more information, go to
+     * https://cloud.google.com/run/docs/securing/using-cmek
+     * 
+ * + * string encryption_key = 7 [(.google.api.resource_reference) = { ... } + * + * @param value The encryptionKey to set. + * @return This builder for chaining. + */ + public Builder setEncryptionKey(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + encryptionKey_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A reference to a customer managed encryption key (CMEK) to use to encrypt
+     * this container image. For more information, go to
+     * https://cloud.google.com/run/docs/securing/using-cmek
+     * 
+ * + * string encryption_key = 7 [(.google.api.resource_reference) = { ... } + * + * @return This builder for chaining. + */ + public Builder clearEncryptionKey() { + + encryptionKey_ = getDefaultInstance().getEncryptionKey(); + onChanged(); + return this; + } + /** + * + * + *
+     * A reference to a customer managed encryption key (CMEK) to use to encrypt
+     * this container image. For more information, go to
+     * https://cloud.google.com/run/docs/securing/using-cmek
+     * 
+ * + * string encryption_key = 7 [(.google.api.resource_reference) = { ... } + * + * @param value The bytes for encryptionKey to set. + * @return This builder for chaining. + */ + public Builder setEncryptionKeyBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + encryptionKey_ = value; + onChanged(); + return this; + } + + private com.google.cloud.run.v2.VpcAccess vpcAccess_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.VpcAccess, + com.google.cloud.run.v2.VpcAccess.Builder, + com.google.cloud.run.v2.VpcAccessOrBuilder> + vpcAccessBuilder_; + /** + * + * + *
+     * VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * .google.cloud.run.v2.VpcAccess vpc_access = 8; + * + * @return Whether the vpcAccess field is set. + */ + public boolean hasVpcAccess() { + return vpcAccessBuilder_ != null || vpcAccess_ != null; + } + /** + * + * + *
+     * VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * .google.cloud.run.v2.VpcAccess vpc_access = 8; + * + * @return The vpcAccess. + */ + public com.google.cloud.run.v2.VpcAccess getVpcAccess() { + if (vpcAccessBuilder_ == null) { + return vpcAccess_ == null + ? com.google.cloud.run.v2.VpcAccess.getDefaultInstance() + : vpcAccess_; + } else { + return vpcAccessBuilder_.getMessage(); + } + } + /** + * + * + *
+     * VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * .google.cloud.run.v2.VpcAccess vpc_access = 8; + */ + public Builder setVpcAccess(com.google.cloud.run.v2.VpcAccess value) { + if (vpcAccessBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + vpcAccess_ = value; + onChanged(); + } else { + vpcAccessBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * .google.cloud.run.v2.VpcAccess vpc_access = 8; + */ + public Builder setVpcAccess(com.google.cloud.run.v2.VpcAccess.Builder builderForValue) { + if (vpcAccessBuilder_ == null) { + vpcAccess_ = builderForValue.build(); + onChanged(); + } else { + vpcAccessBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * .google.cloud.run.v2.VpcAccess vpc_access = 8; + */ + public Builder mergeVpcAccess(com.google.cloud.run.v2.VpcAccess value) { + if (vpcAccessBuilder_ == null) { + if (vpcAccess_ != null) { + vpcAccess_ = + com.google.cloud.run.v2.VpcAccess.newBuilder(vpcAccess_) + .mergeFrom(value) + .buildPartial(); + } else { + vpcAccess_ = value; + } + onChanged(); + } else { + vpcAccessBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * .google.cloud.run.v2.VpcAccess vpc_access = 8; + */ + public Builder clearVpcAccess() { + if (vpcAccessBuilder_ == null) { + vpcAccess_ = null; + onChanged(); + } else { + vpcAccess_ = null; + vpcAccessBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * .google.cloud.run.v2.VpcAccess vpc_access = 8; + */ + public com.google.cloud.run.v2.VpcAccess.Builder getVpcAccessBuilder() { + + onChanged(); + return getVpcAccessFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * .google.cloud.run.v2.VpcAccess vpc_access = 8; + */ + public com.google.cloud.run.v2.VpcAccessOrBuilder getVpcAccessOrBuilder() { + if (vpcAccessBuilder_ != null) { + return vpcAccessBuilder_.getMessageOrBuilder(); + } else { + return vpcAccess_ == null + ? com.google.cloud.run.v2.VpcAccess.getDefaultInstance() + : vpcAccess_; + } + } + /** + * + * + *
+     * VPC Access configuration to use for this Task. For more information,
+     * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+     * 
+ * + * .google.cloud.run.v2.VpcAccess vpc_access = 8; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.VpcAccess, + com.google.cloud.run.v2.VpcAccess.Builder, + com.google.cloud.run.v2.VpcAccessOrBuilder> + getVpcAccessFieldBuilder() { + if (vpcAccessBuilder_ == null) { + vpcAccessBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.VpcAccess, + com.google.cloud.run.v2.VpcAccess.Builder, + com.google.cloud.run.v2.VpcAccessOrBuilder>( + getVpcAccess(), getParentForChildren(), isClean()); + vpcAccess_ = null; + } + return vpcAccessBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.TaskTemplate) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.TaskTemplate) + private static final com.google.cloud.run.v2.TaskTemplate DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.TaskTemplate(); + } + + public static com.google.cloud.run.v2.TaskTemplate getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TaskTemplate parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.TaskTemplate getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskTemplateOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskTemplateOrBuilder.java new file mode 100644 index 000000000000..392404f57e07 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskTemplateOrBuilder.java @@ -0,0 +1,323 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/task_template.proto + +package com.google.cloud.run.v2; + +public interface TaskTemplateOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.TaskTemplate) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + java.util.List getContainersList(); + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + com.google.cloud.run.v2.Container getContainers(int index); + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + int getContainersCount(); + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + java.util.List getContainersOrBuilderList(); + /** + * + * + *
+   * Holds the single container that defines the unit of execution for this
+   * task.
+   * 
+ * + * repeated .google.cloud.run.v2.Container containers = 1; + */ + com.google.cloud.run.v2.ContainerOrBuilder getContainersOrBuilder(int index); + + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + java.util.List getVolumesList(); + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + com.google.cloud.run.v2.Volume getVolumes(int index); + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + int getVolumesCount(); + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + java.util.List getVolumesOrBuilderList(); + /** + * + * + *
+   * A list of Volumes to make available to containers.
+   * 
+ * + * repeated .google.cloud.run.v2.Volume volumes = 2; + */ + com.google.cloud.run.v2.VolumeOrBuilder getVolumesOrBuilder(int index); + + /** + * + * + *
+   * Number of retries allowed per Task, before marking this Task failed.
+   * 
+ * + * int32 max_retries = 3; + * + * @return Whether the maxRetries field is set. + */ + boolean hasMaxRetries(); + /** + * + * + *
+   * Number of retries allowed per Task, before marking this Task failed.
+   * 
+ * + * int32 max_retries = 3; + * + * @return The maxRetries. + */ + int getMaxRetries(); + + /** + * + * + *
+   * Max allowed time duration the Task may be active before the system will
+   * actively try to mark it failed and kill associated containers. This applies
+   * per attempt of a task, meaning each retry can run for the full timeout.
+   * 
+ * + * .google.protobuf.Duration timeout = 4; + * + * @return Whether the timeout field is set. + */ + boolean hasTimeout(); + /** + * + * + *
+   * Max allowed time duration the Task may be active before the system will
+   * actively try to mark it failed and kill associated containers. This applies
+   * per attempt of a task, meaning each retry can run for the full timeout.
+   * 
+ * + * .google.protobuf.Duration timeout = 4; + * + * @return The timeout. + */ + com.google.protobuf.Duration getTimeout(); + /** + * + * + *
+   * Max allowed time duration the Task may be active before the system will
+   * actively try to mark it failed and kill associated containers. This applies
+   * per attempt of a task, meaning each retry can run for the full timeout.
+   * 
+ * + * .google.protobuf.Duration timeout = 4; + */ + com.google.protobuf.DurationOrBuilder getTimeoutOrBuilder(); + + /** + * + * + *
+   * Email address of the IAM service account associated with the Task of a
+   * Job. The service account represents the identity of the
+   * running task, and determines what permissions the task has. If
+   * not provided, the task will use the project's default service account.
+   * 
+ * + * string service_account = 5; + * + * @return The serviceAccount. + */ + java.lang.String getServiceAccount(); + /** + * + * + *
+   * Email address of the IAM service account associated with the Task of a
+   * Job. The service account represents the identity of the
+   * running task, and determines what permissions the task has. If
+   * not provided, the task will use the project's default service account.
+   * 
+ * + * string service_account = 5; + * + * @return The bytes for serviceAccount. + */ + com.google.protobuf.ByteString getServiceAccountBytes(); + + /** + * + * + *
+   * The execution environment being used to host this Task.
+   * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 6; + * + * @return The enum numeric value on the wire for executionEnvironment. + */ + int getExecutionEnvironmentValue(); + /** + * + * + *
+   * The execution environment being used to host this Task.
+   * 
+ * + * .google.cloud.run.v2.ExecutionEnvironment execution_environment = 6; + * + * @return The executionEnvironment. + */ + com.google.cloud.run.v2.ExecutionEnvironment getExecutionEnvironment(); + + /** + * + * + *
+   * A reference to a customer managed encryption key (CMEK) to use to encrypt
+   * this container image. For more information, go to
+   * https://cloud.google.com/run/docs/securing/using-cmek
+   * 
+ * + * string encryption_key = 7 [(.google.api.resource_reference) = { ... } + * + * @return The encryptionKey. + */ + java.lang.String getEncryptionKey(); + /** + * + * + *
+   * A reference to a customer managed encryption key (CMEK) to use to encrypt
+   * this container image. For more information, go to
+   * https://cloud.google.com/run/docs/securing/using-cmek
+   * 
+ * + * string encryption_key = 7 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for encryptionKey. + */ + com.google.protobuf.ByteString getEncryptionKeyBytes(); + + /** + * + * + *
+   * VPC Access configuration to use for this Task. For more information,
+   * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+   * 
+ * + * .google.cloud.run.v2.VpcAccess vpc_access = 8; + * + * @return Whether the vpcAccess field is set. + */ + boolean hasVpcAccess(); + /** + * + * + *
+   * VPC Access configuration to use for this Task. For more information,
+   * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+   * 
+ * + * .google.cloud.run.v2.VpcAccess vpc_access = 8; + * + * @return The vpcAccess. + */ + com.google.cloud.run.v2.VpcAccess getVpcAccess(); + /** + * + * + *
+   * VPC Access configuration to use for this Task. For more information,
+   * visit https://cloud.google.com/run/docs/configuring/connecting-vpc.
+   * 
+ * + * .google.cloud.run.v2.VpcAccess vpc_access = 8; + */ + com.google.cloud.run.v2.VpcAccessOrBuilder getVpcAccessOrBuilder(); + + public com.google.cloud.run.v2.TaskTemplate.RetriesCase getRetriesCase(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskTemplateProto.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskTemplateProto.java new file mode 100644 index 000000000000..1a3f06c96328 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/TaskTemplateProto.java @@ -0,0 +1,99 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/task_template.proto + +package com.google.cloud.run.v2; + +public final class TaskTemplateProto { + private TaskTemplateProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_run_v2_TaskTemplate_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_run_v2_TaskTemplate_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n\'google/cloud/run/v2/task_template.prot" + + "o\022\023google.cloud.run.v2\032\031google/api/resou" + + "rce.proto\032!google/cloud/run/v2/k8s.min.p" + + "roto\032)google/cloud/run/v2/vendor_setting" + + "s.proto\032\036google/protobuf/duration.proto\"" + + "\225\003\n\014TaskTemplate\0222\n\ncontainers\030\001 \003(\0132\036.g" + + "oogle.cloud.run.v2.Container\022,\n\007volumes\030" + + "\002 \003(\0132\033.google.cloud.run.v2.Volume\022\025\n\013ma" + + "x_retries\030\003 \001(\005H\000\022*\n\007timeout\030\004 \001(\0132\031.goo" + + "gle.protobuf.Duration\022\027\n\017service_account" + + "\030\005 \001(\t\022H\n\025execution_environment\030\006 \001(\0162)." + + "google.cloud.run.v2.ExecutionEnvironment" + + "\022>\n\016encryption_key\030\007 \001(\tB&\372A#\n!cloudkms." + + "googleapis.com/CryptoKey\0222\n\nvpc_access\030\010" + + " \001(\0132\036.google.cloud.run.v2.VpcAccessB\t\n\007" + + "retriesBf\n\027com.google.cloud.run.v2B\021Task" + + "TemplateProtoP\001Z6google.golang.org/genpr" + + "oto/googleapis/cloud/run/v2;runb\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.ResourceProto.getDescriptor(), + com.google.cloud.run.v2.K8sMinProto.getDescriptor(), + com.google.cloud.run.v2.VendorSettingsProto.getDescriptor(), + com.google.protobuf.DurationProto.getDescriptor(), + }); + internal_static_google_cloud_run_v2_TaskTemplate_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_run_v2_TaskTemplate_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_run_v2_TaskTemplate_descriptor, + new java.lang.String[] { + "Containers", + "Volumes", + "MaxRetries", + "Timeout", + "ServiceAccount", + "ExecutionEnvironment", + "EncryptionKey", + "VpcAccess", + "Retries", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ResourceProto.resourceReference); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.ResourceProto.getDescriptor(); + com.google.cloud.run.v2.K8sMinProto.getDescriptor(); + com.google.cloud.run.v2.VendorSettingsProto.getDescriptor(); + com.google.protobuf.DurationProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/UpdateJobRequest.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/UpdateJobRequest.java new file mode 100644 index 000000000000..5afbff905de0 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/UpdateJobRequest.java @@ -0,0 +1,885 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +/** + * + * + *
+ * Request message for updating a Job.
+ * 
+ * + * Protobuf type {@code google.cloud.run.v2.UpdateJobRequest} + */ +public final class UpdateJobRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.run.v2.UpdateJobRequest) + UpdateJobRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateJobRequest.newBuilder() to construct. + private UpdateJobRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateJobRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateJobRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_UpdateJobRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_UpdateJobRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.UpdateJobRequest.class, + com.google.cloud.run.v2.UpdateJobRequest.Builder.class); + } + + public static final int JOB_FIELD_NUMBER = 1; + private com.google.cloud.run.v2.Job job_; + /** + * + * + *
+   * Required. The Job to be updated.
+   * 
+ * + * .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the job field is set. + */ + @java.lang.Override + public boolean hasJob() { + return job_ != null; + } + /** + * + * + *
+   * Required. The Job to be updated.
+   * 
+ * + * .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The job. + */ + @java.lang.Override + public com.google.cloud.run.v2.Job getJob() { + return job_ == null ? com.google.cloud.run.v2.Job.getDefaultInstance() : job_; + } + /** + * + * + *
+   * Required. The Job to be updated.
+   * 
+ * + * .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.cloud.run.v2.JobOrBuilder getJobOrBuilder() { + return getJob(); + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 3; + private boolean validateOnly_; + /** + * + * + *
+   * Indicates that the request should be validated and default values
+   * populated, without persisting the request or updating any resources.
+   * 
+ * + * bool validate_only = 3; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + public static final int ALLOW_MISSING_FIELD_NUMBER = 4; + private boolean allowMissing_; + /** + * + * + *
+   * If set to true, and if the Job does not exist, it will create a new
+   * one. Caller must have both create and update permissions for this call if
+   * this is set to true.
+   * 
+ * + * bool allow_missing = 4; + * + * @return The allowMissing. + */ + @java.lang.Override + public boolean getAllowMissing() { + return allowMissing_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (job_ != null) { + output.writeMessage(1, getJob()); + } + if (validateOnly_ != false) { + output.writeBool(3, validateOnly_); + } + if (allowMissing_ != false) { + output.writeBool(4, allowMissing_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (job_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getJob()); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, validateOnly_); + } + if (allowMissing_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, allowMissing_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.run.v2.UpdateJobRequest)) { + return super.equals(obj); + } + com.google.cloud.run.v2.UpdateJobRequest other = (com.google.cloud.run.v2.UpdateJobRequest) obj; + + if (hasJob() != other.hasJob()) return false; + if (hasJob()) { + if (!getJob().equals(other.getJob())) return false; + } + if (getValidateOnly() != other.getValidateOnly()) return false; + if (getAllowMissing() != other.getAllowMissing()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasJob()) { + hash = (37 * hash) + JOB_FIELD_NUMBER; + hash = (53 * hash) + getJob().hashCode(); + } + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (37 * hash) + ALLOW_MISSING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowMissing()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.run.v2.UpdateJobRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.UpdateJobRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.UpdateJobRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.UpdateJobRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.UpdateJobRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.run.v2.UpdateJobRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.run.v2.UpdateJobRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.UpdateJobRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.UpdateJobRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.UpdateJobRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.run.v2.UpdateJobRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.run.v2.UpdateJobRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.run.v2.UpdateJobRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for updating a Job.
+   * 
+ * + * Protobuf type {@code google.cloud.run.v2.UpdateJobRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.run.v2.UpdateJobRequest) + com.google.cloud.run.v2.UpdateJobRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_UpdateJobRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_UpdateJobRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.run.v2.UpdateJobRequest.class, + com.google.cloud.run.v2.UpdateJobRequest.Builder.class); + } + + // Construct using com.google.cloud.run.v2.UpdateJobRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (jobBuilder_ == null) { + job_ = null; + } else { + job_ = null; + jobBuilder_ = null; + } + validateOnly_ = false; + + allowMissing_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.run.v2.JobProto + .internal_static_google_cloud_run_v2_UpdateJobRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.run.v2.UpdateJobRequest getDefaultInstanceForType() { + return com.google.cloud.run.v2.UpdateJobRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.run.v2.UpdateJobRequest build() { + com.google.cloud.run.v2.UpdateJobRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.run.v2.UpdateJobRequest buildPartial() { + com.google.cloud.run.v2.UpdateJobRequest result = + new com.google.cloud.run.v2.UpdateJobRequest(this); + if (jobBuilder_ == null) { + result.job_ = job_; + } else { + result.job_ = jobBuilder_.build(); + } + result.validateOnly_ = validateOnly_; + result.allowMissing_ = allowMissing_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.run.v2.UpdateJobRequest) { + return mergeFrom((com.google.cloud.run.v2.UpdateJobRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.run.v2.UpdateJobRequest other) { + if (other == com.google.cloud.run.v2.UpdateJobRequest.getDefaultInstance()) return this; + if (other.hasJob()) { + mergeJob(other.getJob()); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + if (other.getAllowMissing() != false) { + setAllowMissing(other.getAllowMissing()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(getJobFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 10 + case 24: + { + validateOnly_ = input.readBool(); + + break; + } // case 24 + case 32: + { + allowMissing_ = input.readBool(); + + break; + } // case 32 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private com.google.cloud.run.v2.Job job_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.Job, + com.google.cloud.run.v2.Job.Builder, + com.google.cloud.run.v2.JobOrBuilder> + jobBuilder_; + /** + * + * + *
+     * Required. The Job to be updated.
+     * 
+ * + * .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the job field is set. + */ + public boolean hasJob() { + return jobBuilder_ != null || job_ != null; + } + /** + * + * + *
+     * Required. The Job to be updated.
+     * 
+ * + * .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The job. + */ + public com.google.cloud.run.v2.Job getJob() { + if (jobBuilder_ == null) { + return job_ == null ? com.google.cloud.run.v2.Job.getDefaultInstance() : job_; + } else { + return jobBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The Job to be updated.
+     * 
+ * + * .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setJob(com.google.cloud.run.v2.Job value) { + if (jobBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + job_ = value; + onChanged(); + } else { + jobBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The Job to be updated.
+     * 
+ * + * .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setJob(com.google.cloud.run.v2.Job.Builder builderForValue) { + if (jobBuilder_ == null) { + job_ = builderForValue.build(); + onChanged(); + } else { + jobBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The Job to be updated.
+     * 
+ * + * .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeJob(com.google.cloud.run.v2.Job value) { + if (jobBuilder_ == null) { + if (job_ != null) { + job_ = com.google.cloud.run.v2.Job.newBuilder(job_).mergeFrom(value).buildPartial(); + } else { + job_ = value; + } + onChanged(); + } else { + jobBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The Job to be updated.
+     * 
+ * + * .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearJob() { + if (jobBuilder_ == null) { + job_ = null; + onChanged(); + } else { + job_ = null; + jobBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The Job to be updated.
+     * 
+ * + * .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.run.v2.Job.Builder getJobBuilder() { + + onChanged(); + return getJobFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The Job to be updated.
+     * 
+ * + * .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.run.v2.JobOrBuilder getJobOrBuilder() { + if (jobBuilder_ != null) { + return jobBuilder_.getMessageOrBuilder(); + } else { + return job_ == null ? com.google.cloud.run.v2.Job.getDefaultInstance() : job_; + } + } + /** + * + * + *
+     * Required. The Job to be updated.
+     * 
+ * + * .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.Job, + com.google.cloud.run.v2.Job.Builder, + com.google.cloud.run.v2.JobOrBuilder> + getJobFieldBuilder() { + if (jobBuilder_ == null) { + jobBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.run.v2.Job, + com.google.cloud.run.v2.Job.Builder, + com.google.cloud.run.v2.JobOrBuilder>(getJob(), getParentForChildren(), isClean()); + job_ = null; + } + return jobBuilder_; + } + + private boolean validateOnly_; + /** + * + * + *
+     * Indicates that the request should be validated and default values
+     * populated, without persisting the request or updating any resources.
+     * 
+ * + * bool validate_only = 3; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * Indicates that the request should be validated and default values
+     * populated, without persisting the request or updating any resources.
+     * 
+ * + * bool validate_only = 3; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Indicates that the request should be validated and default values
+     * populated, without persisting the request or updating any resources.
+     * 
+ * + * bool validate_only = 3; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + private boolean allowMissing_; + /** + * + * + *
+     * If set to true, and if the Job does not exist, it will create a new
+     * one. Caller must have both create and update permissions for this call if
+     * this is set to true.
+     * 
+ * + * bool allow_missing = 4; + * + * @return The allowMissing. + */ + @java.lang.Override + public boolean getAllowMissing() { + return allowMissing_; + } + /** + * + * + *
+     * If set to true, and if the Job does not exist, it will create a new
+     * one. Caller must have both create and update permissions for this call if
+     * this is set to true.
+     * 
+ * + * bool allow_missing = 4; + * + * @param value The allowMissing to set. + * @return This builder for chaining. + */ + public Builder setAllowMissing(boolean value) { + + allowMissing_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set to true, and if the Job does not exist, it will create a new
+     * one. Caller must have both create and update permissions for this call if
+     * this is set to true.
+     * 
+ * + * bool allow_missing = 4; + * + * @return This builder for chaining. + */ + public Builder clearAllowMissing() { + + allowMissing_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.run.v2.UpdateJobRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.run.v2.UpdateJobRequest) + private static final com.google.cloud.run.v2.UpdateJobRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.run.v2.UpdateJobRequest(); + } + + public static com.google.cloud.run.v2.UpdateJobRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateJobRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.run.v2.UpdateJobRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/UpdateJobRequestOrBuilder.java b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/UpdateJobRequestOrBuilder.java new file mode 100644 index 000000000000..d82145821952 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/java/com/google/cloud/run/v2/UpdateJobRequestOrBuilder.java @@ -0,0 +1,89 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/run/v2/job.proto + +package com.google.cloud.run.v2; + +public interface UpdateJobRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.run.v2.UpdateJobRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The Job to be updated.
+   * 
+ * + * .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the job field is set. + */ + boolean hasJob(); + /** + * + * + *
+   * Required. The Job to be updated.
+   * 
+ * + * .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The job. + */ + com.google.cloud.run.v2.Job getJob(); + /** + * + * + *
+   * Required. The Job to be updated.
+   * 
+ * + * .google.cloud.run.v2.Job job = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.cloud.run.v2.JobOrBuilder getJobOrBuilder(); + + /** + * + * + *
+   * Indicates that the request should be validated and default values
+   * populated, without persisting the request or updating any resources.
+   * 
+ * + * bool validate_only = 3; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); + + /** + * + * + *
+   * If set to true, and if the Job does not exist, it will create a new
+   * one. Caller must have both create and update permissions for this call if
+   * this is set to true.
+   * 
+ * + * bool allow_missing = 4; + * + * @return The allowMissing. + */ + boolean getAllowMissing(); +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/execution.proto b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/execution.proto new file mode 100644 index 000000000000..0710afb7d071 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/execution.proto @@ -0,0 +1,259 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.run.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/launch_stage.proto"; +import "google/api/resource.proto"; +import "google/cloud/run/v2/condition.proto"; +import "google/cloud/run/v2/task_template.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/run/v2;run"; +option java_multiple_files = true; +option java_outer_classname = "ExecutionProto"; +option java_package = "com.google.cloud.run.v2"; + +// Cloud Run Execution Control Plane API. +service Executions { + option (google.api.default_host) = "run.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Gets information about an Execution. + rpc GetExecution(GetExecutionRequest) returns (Execution) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/jobs/*/executions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists Executions from a Job. + rpc ListExecutions(ListExecutionsRequest) returns (ListExecutionsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*/jobs/*}/executions" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes an Execution. + rpc DeleteExecution(DeleteExecutionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/jobs/*/executions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Execution" + metadata_type: "Execution" + }; + } +} + +// Request message for obtaining a Execution by its full name. +message GetExecutionRequest { + // Required. The full name of the Execution. + // Format: + // projects/{project}/locations/{location}/jobs/{job}/executions/{execution} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "run.googleapis.com/Execution" } + ]; +} + +// Request message for retrieving a list of Executions. +message ListExecutionsRequest { + // Required. The Execution from which the Executions should be listed. + // To list all Executions across Jobs, use "-" instead of Job name. + // Format: projects/{project}/locations/{location}/jobs/{job} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "run.googleapis.com/Execution" + } + ]; + + // Maximum number of Executions to return in this call. + int32 page_size = 2; + + // A page token received from a previous call to ListExecutions. + // All other parameters must match. + string page_token = 3; + + // If true, returns deleted (but unexpired) resources along with active ones. + bool show_deleted = 4; +} + +// Response message containing a list of Executions. +message ListExecutionsResponse { + // The resulting list of Executions. + repeated Execution executions = 1; + + // A token indicating there are more items than page_size. Use it in the next + // ListExecutions request to continue. + string next_page_token = 2; +} + +// Request message for deleting an Execution. +message DeleteExecutionRequest { + // Required. The name of the Execution to delete. + // Format: + // projects/{project}/locations/{location}/jobs/{job}/executions/{execution} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "run.googleapis.com/Execution" } + ]; + + // Indicates that the request should be validated without actually + // deleting any resources. + bool validate_only = 2; + + // A system-generated fingerprint for this version of the resource. + // This may be used to detect modification conflict during updates. + string etag = 3; +} + +// Execution represents the configuration of a single execution. A execution an +// immutable resource that references a container image which is run to +// completion. +message Execution { + option (google.api.resource) = { + type: "run.googleapis.com/Execution" + pattern: "projects/{project}/locations/{location}/jobs/{job}/executions/{execution}" + style: DECLARATIVE_FRIENDLY + }; + + // Output only. The unique name of this Execution. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server assigned unique identifier for the Execution. The value + // is a UUID4 string and guaranteed to remain unchanged until the resource is + // deleted. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A number that monotonically increases every time the user + // modifies the desired state. + int64 generation = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // KRM-style labels for the resource. + // User-provided labels are shared with Google's billing system, so they can + // be used to filter, or break down billing charges by team, component, + // environment, state, etc. For more information, visit + // https://cloud.google.com/resource-manager/docs/creating-managing-labels or + // https://cloud.google.com/run/docs/configuring/labels + // Cloud Run will populate some labels with 'run.googleapis.com' or + // 'serving.knative.dev' namespaces. Those labels are read-only, and user + // changes will not be preserved. + map labels = 4; + + // KRM-style annotations for the resource. + map annotations = 5; + + // Output only. Represents time when the execution was acknowledged by the + // execution controller. It is not guaranteed to be set in happens-before + // order across separate operations. + google.protobuf.Timestamp create_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Represents time when the execution started to run. + // It is not guaranteed to be set in happens-before order across separate + // operations. + google.protobuf.Timestamp start_time = 22 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Represents time when the execution was completed. It is not + // guaranteed to be set in happens-before order across separate operations. + google.protobuf.Timestamp completion_time = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last-modified time. + google.protobuf.Timestamp update_time = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. For a deleted resource, the deletion time. It is only + // populated as a response to a Delete request. + google.protobuf.Timestamp delete_time = 9 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. For a deleted resource, the time after which it will be + // permamently deleted. It is only populated as a response to a Delete + // request. + google.protobuf.Timestamp expire_time = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Set the launch stage to a preview stage on write to allow use of preview + // features in that stage. On read, describes whether the resource uses + // preview features. Launch Stages are defined at [Google Cloud Platform + // Launch Stages](https://cloud.google.com/terms/launch-stages). + google.api.LaunchStage launch_stage = 11; + + // Output only. The name of the parent Job. + string job = 12 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { type: "run.googleapis.com/Job" } + ]; + + // Output only. Specifies the maximum desired number of tasks the execution + // should run at any given time. Must be <= task_count. The actual number of + // tasks running in steady state will be less than this number when + // ((.spec.task_count - .status.successful) < .spec.parallelism), i.e. when + // the work left to do is less than max parallelism. More info: + // https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ + int32 parallelism = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Specifies the desired number of tasks the execution should + // run. Setting to 1 means that parallelism is limited to 1 and the success of + // that task signals the success of the execution. + // More info: + // https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ + int32 task_count = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The template used to create tasks for this execution. + TaskTemplate template = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Indicates whether the resource's reconciliation is still in + // progress. See comments in `Job.reconciling` for additional information on + // reconciliation process in Cloud Run. + bool reconciling = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Condition of this Execution, containing its readiness + // status, and detailed error information in case it did not reach the desired + // state. + repeated google.cloud.run.v2.Condition conditions = 17 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The generation of this Execution. See comments in + // `reconciling` for additional information on reconciliation process in Cloud + // Run. + int64 observed_generation = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The number of actively running tasks. + int32 running_count = 19 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The number of tasks which reached phase Succeeded. + int32 succeeded_count = 20 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The number of tasks which reached phase Failed. + int32 failed_count = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A system-generated fingerprint for this version of the + // resource. May be used to detect modification conflict during updates. + string etag = 99 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/execution_template.proto b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/execution_template.proto new file mode 100644 index 000000000000..e0657f6cb7a5 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/execution_template.proto @@ -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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.run.v2; + +import "google/api/field_behavior.proto"; +import "google/cloud/run/v2/task_template.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/run/v2;run"; +option java_multiple_files = true; +option java_outer_classname = "ExecutionTemplateProto"; +option java_package = "com.google.cloud.run.v2"; + +// ExecutionTemplate describes the data an execution should have when created +// from a template. +message ExecutionTemplate { + // KRM-style labels for the resource. + map labels = 1; + + // KRM-style annotations for the resource. + map annotations = 2; + + // Specifies the maximum desired number of tasks the execution should run at + // given time. Must be <= task_count. + // When the job is run, if this field is 0 or unset, the maximum possible + // value will be used for that execution. + // The actual number of tasks running in steady state will be less than this + // number when there are fewer tasks waiting to be completed remaining, + // i.e. when the work left to do is less than max parallelism. + int32 parallelism = 3; + + // Specifies the desired number of tasks the execution should run. + // Setting to 1 means that parallelism is limited to 1 and the success of + // that task signals the success of the execution. + // More info: + // https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/ + int32 task_count = 4; + + // Required. Describes the task(s) that will be created when executing an execution. + TaskTemplate template = 5 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/job.proto b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/job.proto new file mode 100644 index 000000000000..8a158296ae4b --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/job.proto @@ -0,0 +1,400 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.run.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/launch_stage.proto"; +import "google/api/resource.proto"; +import "google/cloud/run/v2/condition.proto"; +import "google/cloud/run/v2/execution_template.proto"; +import "google/cloud/run/v2/vendor_settings.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/run/v2;run"; +option java_multiple_files = true; +option java_outer_classname = "JobProto"; +option java_package = "com.google.cloud.run.v2"; + +// Cloud Run Job Control Plane API. +service Jobs { + option (google.api.default_host) = "run.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a Job. + rpc CreateJob(CreateJobRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/jobs" + body: "job" + }; + option (google.api.method_signature) = "parent,job,job_id"; + option (google.longrunning.operation_info) = { + response_type: "Job" + metadata_type: "Job" + }; + } + + // Gets information about a Job. + rpc GetJob(GetJobRequest) returns (Job) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/jobs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists Jobs. + rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/jobs" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates a Job. + rpc UpdateJob(UpdateJobRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{job.name=projects/*/locations/*/jobs/*}" + body: "job" + }; + option (google.api.method_signature) = "job"; + option (google.longrunning.operation_info) = { + response_type: "Job" + metadata_type: "Job" + }; + } + + // Deletes a Job. + rpc DeleteJob(DeleteJobRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/jobs/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Job" + metadata_type: "Job" + }; + } + + // Triggers creation of a new Execution of this Job. + rpc RunJob(RunJobRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/jobs/*}:run" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Execution" + metadata_type: "Execution" + }; + } + + // Get the IAM Access Control policy currently in effect for the given Job. + // This result does not include any inherited policies. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + get: "/v2/{resource=projects/*/locations/*/jobs/*}:getIamPolicy" + }; + } + + // Sets the IAM Access control policy for the specified Job. Overwrites + // any existing policy. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v2/{resource=projects/*/locations/*/jobs/*}:setIamPolicy" + body: "*" + }; + } + + // Returns permissions that a caller has on the specified Project. + // + // There are no permissions required for making this API call. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v2/{resource=projects/*/locations/*/jobs/*}:testIamPermissions" + body: "*" + }; + } +} + +// Request message for creating a Job. +message CreateJobRequest { + // Required. The location and project in which this Job should be created. + // Format: projects/{project}/locations/{location} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "run.googleapis.com/Job" + } + ]; + + // Required. The Job instance to create. + Job job = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The unique identifier for the Job. The name of the job becomes + // {parent}/jobs/{job_id}. + string job_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Indicates that the request should be validated and default values + // populated, without persisting the request or creating any resources. + bool validate_only = 4; +} + +// Request message for obtaining a Job by its full name. +message GetJobRequest { + // Required. The full name of the Job. + // Format: projects/{project}/locations/{location}/jobs/{job} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "run.googleapis.com/Job" + } + ]; +} + +// Request message for updating a Job. +message UpdateJobRequest { + // Required. The Job to be updated. + Job job = 1 [(google.api.field_behavior) = REQUIRED]; + + // Indicates that the request should be validated and default values + // populated, without persisting the request or updating any resources. + bool validate_only = 3; + + // If set to true, and if the Job does not exist, it will create a new + // one. Caller must have both create and update permissions for this call if + // this is set to true. + bool allow_missing = 4; +} + +// Request message for retrieving a list of Jobs. +message ListJobsRequest { + // Required. The location and project to list resources on. + // Format: projects/{project}/locations/{location} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "run.googleapis.com/Job" + } + ]; + + // Maximum number of Jobs to return in this call. + int32 page_size = 2; + + // A page token received from a previous call to ListJobs. + // All other parameters must match. + string page_token = 3; + + // If true, returns deleted (but unexpired) resources along with active ones. + bool show_deleted = 4; +} + +// Response message containing a list of Jobs. +message ListJobsResponse { + // The resulting list of Jobs. + repeated Job jobs = 1; + + // A token indicating there are more items than page_size. Use it in the next + // ListJobs request to continue. + string next_page_token = 2; +} + +// Request message to delete a Job by its full name. +message DeleteJobRequest { + // Required. The full name of the Job. + // Format: projects/{project}/locations/{location}/jobs/{job} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "run.googleapis.com/Job" + } + ]; + + // Indicates that the request should be validated without actually + // deleting any resources. + bool validate_only = 3; + + // A system-generated fingerprint for this version of the + // resource. May be used to detect modification conflict during updates. + string etag = 4; +} + +// Request message to create a new Execution of a Job. +message RunJobRequest { + // Required. The full name of the Job. + // Format: projects/{project}/locations/{location}/jobs/{job} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "run.googleapis.com/Job" + } + ]; + + // Indicates that the request should be validated without actually + // deleting any resources. + bool validate_only = 2; + + // A system-generated fingerprint for this version of the + // resource. May be used to detect modification conflict during updates. + string etag = 3; +} + +// Job represents the configuration of a single job. A job an immutable resource +// that references a container image which is run to completion. +message Job { + option (google.api.resource) = { + type: "run.googleapis.com/Job" + pattern: "projects/{project}/locations/{location}/jobs/{job}" + style: DECLARATIVE_FRIENDLY + }; + + // The fully qualified name of this Job. + // + // Format: + // projects/{project}/locations/{location}/jobs/{job} + string name = 1; + + // Output only. Server assigned unique identifier for the Execution. The value is a UUID4 + // string and guaranteed to remain unchanged until the resource is deleted. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A number that monotonically increases every time the user + // modifies the desired state. + int64 generation = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // KRM-style labels for the resource. + // User-provided labels are shared with Google's billing system, so they can + // be used to filter, or break down billing charges by team, component, + // environment, state, etc. For more information, visit + // https://cloud.google.com/resource-manager/docs/creating-managing-labels or + // https://cloud.google.com/run/docs/configuring/labels + // Cloud Run will populate some labels with 'run.googleapis.com' or + // 'serving.knative.dev' namespaces. Those labels are read-only, and user + // changes will not be preserved. + map labels = 4; + + // KRM-style annotations for the resource. Unstructured key value map that may + // be set by external tools to store and arbitrary metadata. + // They are not queryable and should be preserved + // when modifying objects. Cloud Run will populate some annotations using + // 'run.googleapis.com' or 'serving.knative.dev' namespaces. This field + // follows Kubernetes annotations' namespacing, limits, and rules. More info: + // https://kubernetes.io/docs/user-guide/annotations + map annotations = 5; + + // Output only. The creation time. + google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last-modified time. + google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The deletion time. + google.protobuf.Timestamp delete_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. For a deleted resource, the time after which it will be + // permamently deleted. + google.protobuf.Timestamp expire_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Email address of the authenticated creator. + string creator = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Email address of the last authenticated modifier. + string last_modifier = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Arbitrary identifier for the API client. + string client = 12; + + // Arbitrary version identifier for the API client. + string client_version = 13; + + // The launch stage as defined by [Google Cloud Platform + // Launch Stages](https://cloud.google.com/terms/launch-stages). + // Cloud Run supports `ALPHA`, `BETA`, and `GA`. If no value is specified, GA + // is assumed. + google.api.LaunchStage launch_stage = 14; + + // Settings for the Binary Authorization feature. + google.cloud.run.v2.BinaryAuthorization binary_authorization = 15; + + // Required. The template used to create executions for this Job. + ExecutionTemplate template = 16 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The generation of this Job. See comments in `reconciling` for additional + // information on reconciliation process in Cloud Run. + int64 observed_generation = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Condition of this Job, containing its readiness status, and + // detailed error information in case it did not reach the desired state. + google.cloud.run.v2.Condition terminal_condition = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Conditions of all other associated sub-resources. They contain + // additional diagnostics information in case the Job does not reach its + // desired state. See comments in `reconciling` for additional information on + // reconciliation process in Cloud Run. + repeated google.cloud.run.v2.Condition conditions = 19 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Number of executions created for this job. + int32 execution_count = 20 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the last created execution. + ExecutionReference latest_created_execution = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Returns true if the Job is currently being acted upon by the system to + // bring it into the desired state. + // + // When a new Job is created, or an existing one is updated, Cloud Run + // will asynchronously perform all necessary steps to bring the Job to the + // desired state. This process is called reconciliation. + // While reconciliation is in process, `observed_generation` and + // `latest_succeeded_execution`, will have transient values that might + // mismatch the intended state: Once reconciliation is over (and this field is + // false), there are two possible outcomes: reconciliation succeeded and the + // state matches the Job, or there was an error, and reconciliation failed. + // This state can be found in `terminal_condition.state`. + // + // If reconciliation succeeded, the following fields will match: + // `observed_generation` and `generation`, `latest_succeeded_execution` and + // `latest_created_execution`. + // + // If reconciliation failed, `observed_generation` and + // `latest_succeeded_execution` will have the state of the last succeeded + // execution or empty for newly created Job. Additional information on the + // failure can be found in `terminal_condition` and `conditions`. + bool reconciling = 23 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A system-generated fingerprint for this version of the + // resource. May be used to detect modification conflict during updates. + string etag = 99 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Reference to an Execution. Use /Executions.GetExecution with the given name +// to get full execution including the latest status. +message ExecutionReference { + // Name of the execution. + string name = 1 [(google.api.resource_reference) = { + type: "run.googleapis.com/Execution" + }]; + + // Creation timestamp of the execution. + google.protobuf.Timestamp create_time = 2; + + // Creation timestamp of the execution. + google.protobuf.Timestamp completion_time = 3; +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/revision.proto b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/revision.proto index 0cb674e8178f..5980d31ed1bc 100644 --- a/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/revision.proto +++ b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/revision.proto @@ -53,7 +53,7 @@ service Revisions { option (google.api.method_signature) = "name"; } - // List Revisions from a given Service, or from a given location. + // Lists Revisions from a given Service, or from a given location. rpc ListRevisions(ListRevisionsRequest) returns (ListRevisionsResponse) { option (google.api.http) = { get: "/v2/{parent=projects/*/locations/*/services/*}/revisions" @@ -67,7 +67,7 @@ service Revisions { option (google.api.method_signature) = "parent"; } - // Delete a Revision. + // Deletes a Revision. rpc DeleteRevision(DeleteRevisionRequest) returns (google.longrunning.Operation) { option (google.api.http) = { delete: "/v2/{name=projects/*/locations/*/services/*/revisions/*}" @@ -221,11 +221,11 @@ message Revision { ]; // Scaling settings for this revision. - RevisionScaling scaling = 12; + google.cloud.run.v2.RevisionScaling scaling = 12; // VPC Access configuration for this Revision. For more information, visit // https://cloud.google.com/run/docs/configuring/connecting-vpc. - VpcAccess vpc_access = 13; + google.cloud.run.v2.VpcAccess vpc_access = 13; // Sets the maximum number of requests that each serving instance can receive. int32 max_instance_request_concurrency = 34; @@ -240,13 +240,13 @@ message Revision { // Holds the single container that defines the unit of execution for this // Revision. - repeated Container containers = 17; + repeated google.cloud.run.v2.Container containers = 17; // A list of Volumes to make available to containers. - repeated Volume volumes = 18; + repeated google.cloud.run.v2.Volume volumes = 18; // The execution environment being used to host this Revision. - ExecutionEnvironment execution_environment = 20; + google.cloud.run.v2.ExecutionEnvironment execution_environment = 20; // A reference to a customer managed encryption key (CMEK) to use to encrypt // this container image. For more information, go to @@ -262,7 +262,7 @@ message Revision { // Output only. The Condition of this Revision, containing its readiness status, and // detailed error information in case it did not reach a serving state. - repeated Condition conditions = 31 [(google.api.field_behavior) = OUTPUT_ONLY]; + repeated google.cloud.run.v2.Condition conditions = 31 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The generation of this Revision currently serving traffic. See comments in // `reconciling` for additional information on reconciliation process in Cloud diff --git a/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/revision_template.proto b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/revision_template.proto index f20fb5eb68a5..7389986d7d80 100644 --- a/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/revision_template.proto +++ b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/revision_template.proto @@ -42,11 +42,11 @@ message RevisionTemplate { map annotations = 3; // Scaling settings for this Revision. - RevisionScaling scaling = 4; + google.cloud.run.v2.RevisionScaling scaling = 4; // VPC Access configuration to use for this Revision. For more information, // visit https://cloud.google.com/run/docs/configuring/connecting-vpc. - VpcAccess vpc_access = 6; + google.cloud.run.v2.VpcAccess vpc_access = 6; // Max allowed time for an instance to respond to a request. google.protobuf.Duration timeout = 8; @@ -59,13 +59,13 @@ message RevisionTemplate { // Holds the single container that defines the unit of execution for this // Revision. - repeated Container containers = 10; + repeated google.cloud.run.v2.Container containers = 10; // A list of Volumes to make available to containers. - repeated Volume volumes = 11; + repeated google.cloud.run.v2.Volume volumes = 11; // The sandbox environment to host this Revision. - ExecutionEnvironment execution_environment = 13; + google.cloud.run.v2.ExecutionEnvironment execution_environment = 13; // A reference to a customer managed encryption key (CMEK) to use to encrypt // this container image. For more information, go to diff --git a/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/service.proto b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/service.proto index 08823925b5f3..5c3a05ae4b3b 100644 --- a/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/service.proto +++ b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/service.proto @@ -74,7 +74,7 @@ service Services { option (google.api.method_signature) = "name"; } - // List Services. + // Lists Services. rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { option (google.api.http) = { get: "/v2/{parent=projects/*/locations/*}/services" @@ -127,7 +127,7 @@ service Services { }; } - // Get the IAM Access Control policy currently in effect for the given + // Gets the IAM Access Control policy currently in effect for the given // Cloud Run Service. This result does not include any inherited policies. rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { option (google.api.http) = { @@ -157,7 +157,7 @@ service Services { // Request message for creating a Service. message CreateServiceRequest { - // The location and project in which this service should be created. + // Required. The location and project in which this service should be created. // Format: projects/{project}/locations/{location} // Only lowercase characters, digits, and hyphens. string parent = 1 [ @@ -342,7 +342,7 @@ message Service { // Provides the ingress settings for this Service. On output, returns the // currently observed ingress settings, or INGRESS_TRAFFIC_UNSPECIFIED if no // revision is active. - IngressTraffic ingress = 15; + google.cloud.run.v2.IngressTraffic ingress = 15; // The launch stage as defined by [Google Cloud Platform // Launch Stages](https://cloud.google.com/terms/launch-stages). @@ -351,7 +351,7 @@ message Service { google.api.LaunchStage launch_stage = 16; // Settings for the Binary Authorization feature. - BinaryAuthorization binary_authorization = 17; + google.cloud.run.v2.BinaryAuthorization binary_authorization = 17; // Required. The template used to create revisions for this Service. RevisionTemplate template = 18 [(google.api.field_behavior) = REQUIRED]; @@ -359,7 +359,7 @@ message Service { // Specifies how to distribute traffic over a collection of Revisions // belonging to the Service. If traffic is empty or not provided, defaults to // 100% traffic to the latest `Ready` Revision. - repeated TrafficTarget traffic = 19; + repeated google.cloud.run.v2.TrafficTarget traffic = 19; // Output only. The generation of this Service currently serving traffic. See comments in // `reconciling` for additional information on reconciliation process in Cloud @@ -372,13 +372,13 @@ message Service { // detailed error information in case it did not reach a serving state. See // comments in `reconciling` for additional information on reconciliation // process in Cloud Run. - Condition terminal_condition = 31 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.cloud.run.v2.Condition terminal_condition = 31 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The Conditions of all other associated sub-resources. They contain // additional diagnostics information in case the Service does not reach its // Serving state. See comments in `reconciling` for additional information on // reconciliation process in Cloud Run. - repeated Condition conditions = 32 [(google.api.field_behavior) = OUTPUT_ONLY]; + repeated google.cloud.run.v2.Condition conditions = 32 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Name of the latest revision that is serving traffic. See comments in // `reconciling` for additional information on reconciliation process in Cloud @@ -402,7 +402,7 @@ message Service { // Output only. Detailed status information for corresponding traffic targets. See comments // in `reconciling` for additional information on reconciliation process in // Cloud Run. - repeated TrafficTargetStatus traffic_statuses = 35 [(google.api.field_behavior) = OUTPUT_ONLY]; + repeated google.cloud.run.v2.TrafficTargetStatus traffic_statuses = 35 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The main URI in which this Service is serving traffic. string uri = 36 [(google.api.field_behavior) = OUTPUT_ONLY]; diff --git a/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/task.proto b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/task.proto new file mode 100644 index 000000000000..86ed7cb955a2 --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/task.proto @@ -0,0 +1,256 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.run.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/run/v2/condition.proto"; +import "google/cloud/run/v2/k8s.min.proto"; +import "google/cloud/run/v2/vendor_settings.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/run/v2;run"; +option java_multiple_files = true; +option java_outer_classname = "TaskProto"; +option java_package = "com.google.cloud.run.v2"; + +// Cloud Run Task Control Plane API. +service Tasks { + option (google.api.default_host) = "run.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Gets information about a Task. + rpc GetTask(GetTaskRequest) returns (Task) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/jobs/*/executions/*/tasks/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists Tasks from an Execution of a Job. + rpc ListTasks(ListTasksRequest) returns (ListTasksResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*/jobs/*/executions/*}/tasks" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Request message for obtaining a Task by its full name. +message GetTaskRequest { + // Required. The full name of the Task. + // Format: + // projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "run.googleapis.com/Task" + } + ]; +} + +// Request message for retrieving a list of Tasks. +message ListTasksRequest { + // Required. The Execution from which the Tasks should be listed. + // To list all Tasks across Executions of a Job, use "-" instead of Execution + // name. To list all Tasks across Jobs, use "-" instead of Job name. Format: + // projects/{project}/locations/{location}/jobs/{job}/executions/{execution} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "run.googleapis.com/Task" + } + ]; + + // Maximum number of Tasks to return in this call. + int32 page_size = 2; + + // A page token received from a previous call to ListTasks. + // All other parameters must match. + string page_token = 3; + + // If true, returns deleted (but unexpired) resources along with active ones. + bool show_deleted = 4; +} + +// Response message containing a list of Tasks. +message ListTasksResponse { + // The resulting list of Tasks. + repeated Task tasks = 1; + + // A token indicating there are more items than page_size. Use it in the next + // ListTasks request to continue. + string next_page_token = 2; +} + +// Task represents a single run of a container to completion. +message Task { + option (google.api.resource) = { + type: "run.googleapis.com/Task" + pattern: "projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}" + style: DECLARATIVE_FRIENDLY + }; + + // Output only. The unique name of this Task. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server assigned unique identifier for the Task. The value is a UUID4 + // string and guaranteed to remain unchanged until the resource is deleted. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A number that monotonically increases every time the user + // modifies the desired state. + int64 generation = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // KRM-style labels for the resource. + // User-provided labels are shared with Google's billing system, so they can + // be used to filter, or break down billing charges by team, component, + // environment, state, etc. For more information, visit + // https://cloud.google.com/resource-manager/docs/creating-managing-labels or + // https://cloud.google.com/run/docs/configuring/labels + // Cloud Run will populate some labels with 'run.googleapis.com' or + // 'serving.knative.dev' namespaces. Those labels are read-only, and user + // changes will not be preserved. + map labels = 4; + + // KRM-style annotations for the resource. + map annotations = 5; + + // Output only. Represents time when the task was created by the job controller. + // It is not guaranteed to be set in happens-before order across separate + // operations. + google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Represents time when the task started to run. + // It is not guaranteed to be set in happens-before order across separate + // operations. + google.protobuf.Timestamp start_time = 27 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Represents time when the Task was completed. It is not guaranteed to + // be set in happens-before order across separate operations. + google.protobuf.Timestamp completion_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last-modified time. + google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. For a deleted resource, the deletion time. It is only + // populated as a response to a Delete request. + google.protobuf.Timestamp delete_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. For a deleted resource, the time after which it will be + // permamently deleted. It is only populated as a response to a Delete + // request. + google.protobuf.Timestamp expire_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The name of the parent Job. + string job = 12 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "run.googleapis.com/Job" + } + ]; + + // Output only. The name of the parent Execution. + string execution = 13 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "run.googleapis.com/Execution" + } + ]; + + // Holds the single container that defines the unit of execution for this + // task. + repeated google.cloud.run.v2.Container containers = 14; + + // A list of Volumes to make available to containers. + repeated google.cloud.run.v2.Volume volumes = 15; + + // Number of retries allowed per Task, before marking this Task failed. + int32 max_retries = 16; + + // Max allowed time duration the Task may be active before the system will + // actively try to mark it failed and kill associated containers. This applies + // per attempt of a task, meaning each retry can run for the full timeout. + google.protobuf.Duration timeout = 17; + + // Email address of the IAM service account associated with the Task of a + // Job. The service account represents the identity of the + // running task, and determines what permissions the task has. If + // not provided, the task will use the project's default service account. + string service_account = 18; + + // The execution environment being used to host this Task. + google.cloud.run.v2.ExecutionEnvironment execution_environment = 20; + + // Output only. Indicates whether the resource's reconciliation is still in progress. + // See comments in `Job.reconciling` for additional information on + // reconciliation process in Cloud Run. + bool reconciling = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Condition of this Task, containing its readiness status, and + // detailed error information in case it did not reach the desired state. + repeated google.cloud.run.v2.Condition conditions = 22 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The generation of this Task. See comments in `Job.reconciling` + // for additional information on reconciliation process in Cloud Run. + int64 observed_generation = 23 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Index of the Task, unique per execution, and beginning at 0. + int32 index = 24 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The number of times this Task was retried. + // Tasks are retried when they fail up to the maxRetries limit. + int32 retried = 25 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Result of the last attempt of this Task. + TaskAttemptResult last_attempt_result = 26 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A reference to a customer managed encryption key (CMEK) to use to encrypt + // this container image. For more information, go to + // https://cloud.google.com/run/docs/securing/using-cmek + string encryption_key = 28 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + } + ]; + + // Output only. VPC Access configuration to use for this Task. For more information, + // visit https://cloud.google.com/run/docs/configuring/connecting-vpc. + google.cloud.run.v2.VpcAccess vpc_access = 29 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A system-generated fingerprint for this version of the + // resource. May be used to detect modification conflict during updates. + string etag = 99 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Result of a task attempt. +message TaskAttemptResult { + // Output only. The status of this attempt. + // If the status code is OK, then the attempt succeeded. + google.rpc.Status status = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The exit code of this attempt. + // This may be unset if the container was unable to exit cleanly with a code + // due to some other failure. + // See status field for possible failure details. + int32 exit_code = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/task_template.proto b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/task_template.proto new file mode 100644 index 000000000000..ae7ee47af5fa --- /dev/null +++ b/java-run/proto-google-cloud-run-v2/src/main/proto/google/cloud/run/v2/task_template.proto @@ -0,0 +1,68 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.run.v2; + +import "google/api/resource.proto"; +import "google/cloud/run/v2/k8s.min.proto"; +import "google/cloud/run/v2/vendor_settings.proto"; +import "google/protobuf/duration.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/run/v2;run"; +option java_multiple_files = true; +option java_outer_classname = "TaskTemplateProto"; +option java_package = "com.google.cloud.run.v2"; + +// TaskTemplate describes the data a task should have when created +// from a template. +message TaskTemplate { + // Holds the single container that defines the unit of execution for this + // task. + repeated google.cloud.run.v2.Container containers = 1; + + // A list of Volumes to make available to containers. + repeated google.cloud.run.v2.Volume volumes = 2; + + oneof retries { + // Number of retries allowed per Task, before marking this Task failed. + int32 max_retries = 3; + } + + // Max allowed time duration the Task may be active before the system will + // actively try to mark it failed and kill associated containers. This applies + // per attempt of a task, meaning each retry can run for the full timeout. + google.protobuf.Duration timeout = 4; + + // Email address of the IAM service account associated with the Task of a + // Job. The service account represents the identity of the + // running task, and determines what permissions the task has. If + // not provided, the task will use the project's default service account. + string service_account = 5; + + // The execution environment being used to host this Task. + google.cloud.run.v2.ExecutionEnvironment execution_environment = 6; + + // A reference to a customer managed encryption key (CMEK) to use to encrypt + // this container image. For more information, go to + // https://cloud.google.com/run/docs/securing/using-cmek + string encryption_key = 7 [(google.api.resource_reference) = { + type: "cloudkms.googleapis.com/CryptoKey" + }]; + + // VPC Access configuration to use for this Task. For more information, + // visit https://cloud.google.com/run/docs/configuring/connecting-vpc. + google.cloud.run.v2.VpcAccess vpc_access = 8; +} diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/create/SyncCreateSetCredentialsProvider.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..f9232fb8cb55 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/create/SyncCreateSetCredentialsProvider.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.run.v2.samples; + +// [START run_v2_generated_Executions_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.run.v2.ExecutionsClient; +import com.google.cloud.run.v2.ExecutionsSettings; +import com.google.cloud.run.v2.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 and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + ExecutionsSettings executionsSettings = + ExecutionsSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + ExecutionsClient executionsClient = ExecutionsClient.create(executionsSettings); + } +} +// [END run_v2_generated_Executions_Create_SetCredentialsProvider_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/create/SyncCreateSetCredentialsProvider1.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 000000000000..579173a8ee59 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/create/SyncCreateSetCredentialsProvider1.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.run.v2.samples; + +// [START run_v2_generated_Executions_Create_SetCredentialsProvider1_sync] +import com.google.cloud.run.v2.ExecutionsClient; +import com.google.cloud.run.v2.ExecutionsSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + ExecutionsSettings executionsSettings = ExecutionsSettings.newHttpJsonBuilder().build(); + ExecutionsClient executionsClient = ExecutionsClient.create(executionsSettings); + } +} +// [END run_v2_generated_Executions_Create_SetCredentialsProvider1_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/create/SyncCreateSetEndpoint.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..50331bb37729 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/create/SyncCreateSetEndpoint.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.run.v2.samples; + +// [START run_v2_generated_Executions_Create_SetEndpoint_sync] +import com.google.cloud.run.v2.ExecutionsClient; +import com.google.cloud.run.v2.ExecutionsSettings; +import com.google.cloud.run.v2.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 and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + ExecutionsSettings executionsSettings = + ExecutionsSettings.newBuilder().setEndpoint(myEndpoint).build(); + ExecutionsClient executionsClient = ExecutionsClient.create(executionsSettings); + } +} +// [END run_v2_generated_Executions_Create_SetEndpoint_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/AsyncDeleteExecution.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/AsyncDeleteExecution.java new file mode 100644 index 000000000000..ccb5ce0f37d4 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/AsyncDeleteExecution.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.run.v2.samples; + +// [START run_v2_generated_Executions_DeleteExecution_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.run.v2.DeleteExecutionRequest; +import com.google.cloud.run.v2.ExecutionName; +import com.google.cloud.run.v2.ExecutionsClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteExecution { + + public static void main(String[] args) throws Exception { + asyncDeleteExecution(); + } + + public static void asyncDeleteExecution() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (ExecutionsClient executionsClient = ExecutionsClient.create()) { + DeleteExecutionRequest request = + DeleteExecutionRequest.newBuilder() + .setName( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + ApiFuture future = executionsClient.deleteExecutionCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END run_v2_generated_Executions_DeleteExecution_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/AsyncDeleteExecutionLRO.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/AsyncDeleteExecutionLRO.java new file mode 100644 index 000000000000..64c04ff464b3 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/AsyncDeleteExecutionLRO.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.run.v2.samples; + +// [START run_v2_generated_Executions_DeleteExecution_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.run.v2.DeleteExecutionRequest; +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.ExecutionName; +import com.google.cloud.run.v2.ExecutionsClient; + +public class AsyncDeleteExecutionLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteExecutionLRO(); + } + + public static void asyncDeleteExecutionLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (ExecutionsClient executionsClient = ExecutionsClient.create()) { + DeleteExecutionRequest request = + DeleteExecutionRequest.newBuilder() + .setName( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + OperationFuture future = + executionsClient.deleteExecutionOperationCallable().futureCall(request); + // Do something. + Execution response = future.get(); + } + } +} +// [END run_v2_generated_Executions_DeleteExecution_LRO_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/SyncDeleteExecution.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/SyncDeleteExecution.java new file mode 100644 index 000000000000..f13b049a6c9e --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/SyncDeleteExecution.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.run.v2.samples; + +// [START run_v2_generated_Executions_DeleteExecution_sync] +import com.google.cloud.run.v2.DeleteExecutionRequest; +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.ExecutionName; +import com.google.cloud.run.v2.ExecutionsClient; + +public class SyncDeleteExecution { + + public static void main(String[] args) throws Exception { + syncDeleteExecution(); + } + + public static void syncDeleteExecution() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (ExecutionsClient executionsClient = ExecutionsClient.create()) { + DeleteExecutionRequest request = + DeleteExecutionRequest.newBuilder() + .setName( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + Execution response = executionsClient.deleteExecutionAsync(request).get(); + } + } +} +// [END run_v2_generated_Executions_DeleteExecution_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/SyncDeleteExecutionExecutionname.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/SyncDeleteExecutionExecutionname.java new file mode 100644 index 000000000000..2253410b171d --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/SyncDeleteExecutionExecutionname.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.run.v2.samples; + +// [START run_v2_generated_Executions_DeleteExecution_Executionname_sync] +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.ExecutionName; +import com.google.cloud.run.v2.ExecutionsClient; + +public class SyncDeleteExecutionExecutionname { + + public static void main(String[] args) throws Exception { + syncDeleteExecutionExecutionname(); + } + + public static void syncDeleteExecutionExecutionname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (ExecutionsClient executionsClient = ExecutionsClient.create()) { + ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"); + Execution response = executionsClient.deleteExecutionAsync(name).get(); + } + } +} +// [END run_v2_generated_Executions_DeleteExecution_Executionname_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/SyncDeleteExecutionString.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/SyncDeleteExecutionString.java new file mode 100644 index 000000000000..a363c85f364a --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/deleteexecution/SyncDeleteExecutionString.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.run.v2.samples; + +// [START run_v2_generated_Executions_DeleteExecution_String_sync] +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.ExecutionName; +import com.google.cloud.run.v2.ExecutionsClient; + +public class SyncDeleteExecutionString { + + public static void main(String[] args) throws Exception { + syncDeleteExecutionString(); + } + + public static void syncDeleteExecutionString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (ExecutionsClient executionsClient = ExecutionsClient.create()) { + String name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString(); + Execution response = executionsClient.deleteExecutionAsync(name).get(); + } + } +} +// [END run_v2_generated_Executions_DeleteExecution_String_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/AsyncGetExecution.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/AsyncGetExecution.java new file mode 100644 index 000000000000..e6fb8c899728 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/AsyncGetExecution.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.run.v2.samples; + +// [START run_v2_generated_Executions_GetExecution_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.ExecutionName; +import com.google.cloud.run.v2.ExecutionsClient; +import com.google.cloud.run.v2.GetExecutionRequest; + +public class AsyncGetExecution { + + public static void main(String[] args) throws Exception { + asyncGetExecution(); + } + + public static void asyncGetExecution() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (ExecutionsClient executionsClient = ExecutionsClient.create()) { + GetExecutionRequest request = + GetExecutionRequest.newBuilder() + .setName( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .build(); + ApiFuture future = executionsClient.getExecutionCallable().futureCall(request); + // Do something. + Execution response = future.get(); + } + } +} +// [END run_v2_generated_Executions_GetExecution_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/SyncGetExecution.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/SyncGetExecution.java new file mode 100644 index 000000000000..76c6e01e0747 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/SyncGetExecution.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.run.v2.samples; + +// [START run_v2_generated_Executions_GetExecution_sync] +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.ExecutionName; +import com.google.cloud.run.v2.ExecutionsClient; +import com.google.cloud.run.v2.GetExecutionRequest; + +public class SyncGetExecution { + + public static void main(String[] args) throws Exception { + syncGetExecution(); + } + + public static void syncGetExecution() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (ExecutionsClient executionsClient = ExecutionsClient.create()) { + GetExecutionRequest request = + GetExecutionRequest.newBuilder() + .setName( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .build(); + Execution response = executionsClient.getExecution(request); + } + } +} +// [END run_v2_generated_Executions_GetExecution_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/SyncGetExecutionExecutionname.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/SyncGetExecutionExecutionname.java new file mode 100644 index 000000000000..661c4ef491a3 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/SyncGetExecutionExecutionname.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.run.v2.samples; + +// [START run_v2_generated_Executions_GetExecution_Executionname_sync] +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.ExecutionName; +import com.google.cloud.run.v2.ExecutionsClient; + +public class SyncGetExecutionExecutionname { + + public static void main(String[] args) throws Exception { + syncGetExecutionExecutionname(); + } + + public static void syncGetExecutionExecutionname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (ExecutionsClient executionsClient = ExecutionsClient.create()) { + ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"); + Execution response = executionsClient.getExecution(name); + } + } +} +// [END run_v2_generated_Executions_GetExecution_Executionname_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/SyncGetExecutionString.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/SyncGetExecutionString.java new file mode 100644 index 000000000000..6d1ef49cd203 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/getexecution/SyncGetExecutionString.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.run.v2.samples; + +// [START run_v2_generated_Executions_GetExecution_String_sync] +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.ExecutionName; +import com.google.cloud.run.v2.ExecutionsClient; + +public class SyncGetExecutionString { + + public static void main(String[] args) throws Exception { + syncGetExecutionString(); + } + + public static void syncGetExecutionString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (ExecutionsClient executionsClient = ExecutionsClient.create()) { + String name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString(); + Execution response = executionsClient.getExecution(name); + } + } +} +// [END run_v2_generated_Executions_GetExecution_String_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/AsyncListExecutions.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/AsyncListExecutions.java new file mode 100644 index 000000000000..cf296fa06929 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/AsyncListExecutions.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.run.v2.samples; + +// [START run_v2_generated_Executions_ListExecutions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.ExecutionsClient; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.ListExecutionsRequest; + +public class AsyncListExecutions { + + public static void main(String[] args) throws Exception { + asyncListExecutions(); + } + + public static void asyncListExecutions() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (ExecutionsClient executionsClient = ExecutionsClient.create()) { + ListExecutionsRequest request = + ListExecutionsRequest.newBuilder() + .setParent(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + ApiFuture future = + executionsClient.listExecutionsPagedCallable().futureCall(request); + // Do something. + for (Execution element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END run_v2_generated_Executions_ListExecutions_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/AsyncListExecutionsPaged.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/AsyncListExecutionsPaged.java new file mode 100644 index 000000000000..34d91f4f1293 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/AsyncListExecutionsPaged.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.run.v2.samples; + +// [START run_v2_generated_Executions_ListExecutions_Paged_async] +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.ExecutionsClient; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.ListExecutionsRequest; +import com.google.cloud.run.v2.ListExecutionsResponse; +import com.google.common.base.Strings; + +public class AsyncListExecutionsPaged { + + public static void main(String[] args) throws Exception { + asyncListExecutionsPaged(); + } + + public static void asyncListExecutionsPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (ExecutionsClient executionsClient = ExecutionsClient.create()) { + ListExecutionsRequest request = + ListExecutionsRequest.newBuilder() + .setParent(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + while (true) { + ListExecutionsResponse response = executionsClient.listExecutionsCallable().call(request); + for (Execution element : response.getExecutionsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END run_v2_generated_Executions_ListExecutions_Paged_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/SyncListExecutions.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/SyncListExecutions.java new file mode 100644 index 000000000000..51b13626a600 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/SyncListExecutions.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.run.v2.samples; + +// [START run_v2_generated_Executions_ListExecutions_sync] +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.ExecutionsClient; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.ListExecutionsRequest; + +public class SyncListExecutions { + + public static void main(String[] args) throws Exception { + syncListExecutions(); + } + + public static void syncListExecutions() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (ExecutionsClient executionsClient = ExecutionsClient.create()) { + ListExecutionsRequest request = + ListExecutionsRequest.newBuilder() + .setParent(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + for (Execution element : executionsClient.listExecutions(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END run_v2_generated_Executions_ListExecutions_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/SyncListExecutionsJobname.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/SyncListExecutionsJobname.java new file mode 100644 index 000000000000..81665fec2450 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/SyncListExecutionsJobname.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.run.v2.samples; + +// [START run_v2_generated_Executions_ListExecutions_Jobname_sync] +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.ExecutionsClient; +import com.google.cloud.run.v2.JobName; + +public class SyncListExecutionsJobname { + + public static void main(String[] args) throws Exception { + syncListExecutionsJobname(); + } + + public static void syncListExecutionsJobname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (ExecutionsClient executionsClient = ExecutionsClient.create()) { + JobName parent = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + for (Execution element : executionsClient.listExecutions(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END run_v2_generated_Executions_ListExecutions_Jobname_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/SyncListExecutionsString.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/SyncListExecutionsString.java new file mode 100644 index 000000000000..3c828b06d850 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executions/listexecutions/SyncListExecutionsString.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.run.v2.samples; + +// [START run_v2_generated_Executions_ListExecutions_String_sync] +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.ExecutionsClient; +import com.google.cloud.run.v2.JobName; + +public class SyncListExecutionsString { + + public static void main(String[] args) throws Exception { + syncListExecutionsString(); + } + + public static void syncListExecutionsString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (ExecutionsClient executionsClient = ExecutionsClient.create()) { + String parent = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString(); + for (Execution element : executionsClient.listExecutions(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END run_v2_generated_Executions_ListExecutions_String_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/executionssettings/getexecution/SyncGetExecution.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executionssettings/getexecution/SyncGetExecution.java new file mode 100644 index 000000000000..8d6e099fa16d --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/executionssettings/getexecution/SyncGetExecution.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.run.v2.samples; + +// [START run_v2_generated_ExecutionsSettings_GetExecution_sync] +import com.google.cloud.run.v2.ExecutionsSettings; +import java.time.Duration; + +public class SyncGetExecution { + + public static void main(String[] args) throws Exception { + syncGetExecution(); + } + + public static void syncGetExecution() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + ExecutionsSettings.Builder executionsSettingsBuilder = ExecutionsSettings.newBuilder(); + executionsSettingsBuilder + .getExecutionSettings() + .setRetrySettings( + executionsSettingsBuilder.getExecutionSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ExecutionsSettings executionsSettings = executionsSettingsBuilder.build(); + } +} +// [END run_v2_generated_ExecutionsSettings_GetExecution_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/create/SyncCreateSetCredentialsProvider.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..482b16e5b750 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/create/SyncCreateSetCredentialsProvider.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.run.v2.samples; + +// [START run_v2_generated_Jobs_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.JobsSettings; +import com.google.cloud.run.v2.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 and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + JobsSettings jobsSettings = + JobsSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + JobsClient jobsClient = JobsClient.create(jobsSettings); + } +} +// [END run_v2_generated_Jobs_Create_SetCredentialsProvider_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/create/SyncCreateSetCredentialsProvider1.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 000000000000..778d2b01191b --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/create/SyncCreateSetCredentialsProvider1.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.run.v2.samples; + +// [START run_v2_generated_Jobs_Create_SetCredentialsProvider1_sync] +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.JobsSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + JobsSettings jobsSettings = JobsSettings.newHttpJsonBuilder().build(); + JobsClient jobsClient = JobsClient.create(jobsSettings); + } +} +// [END run_v2_generated_Jobs_Create_SetCredentialsProvider1_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/create/SyncCreateSetEndpoint.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..c206bf25f155 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/create/SyncCreateSetEndpoint.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.run.v2.samples; + +// [START run_v2_generated_Jobs_Create_SetEndpoint_sync] +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.JobsSettings; +import com.google.cloud.run.v2.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 and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + JobsSettings jobsSettings = JobsSettings.newBuilder().setEndpoint(myEndpoint).build(); + JobsClient jobsClient = JobsClient.create(jobsSettings); + } +} +// [END run_v2_generated_Jobs_Create_SetEndpoint_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/AsyncCreateJob.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/AsyncCreateJob.java new file mode 100644 index 000000000000..5452485747b4 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/AsyncCreateJob.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.run.v2.samples; + +// [START run_v2_generated_Jobs_CreateJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.run.v2.CreateJobRequest; +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateJob { + + public static void main(String[] args) throws Exception { + asyncCreateJob(); + } + + public static void asyncCreateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + CreateJobRequest request = + CreateJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setJob(Job.newBuilder().build()) + .setJobId("jobId101296568") + .setValidateOnly(true) + .build(); + ApiFuture future = jobsClient.createJobCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END run_v2_generated_Jobs_CreateJob_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/AsyncCreateJobLRO.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/AsyncCreateJobLRO.java new file mode 100644 index 000000000000..c4b2b7400a90 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/AsyncCreateJobLRO.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.run.v2.samples; + +// [START run_v2_generated_Jobs_CreateJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.run.v2.CreateJobRequest; +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.LocationName; + +public class AsyncCreateJobLRO { + + public static void main(String[] args) throws Exception { + asyncCreateJobLRO(); + } + + public static void asyncCreateJobLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + CreateJobRequest request = + CreateJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setJob(Job.newBuilder().build()) + .setJobId("jobId101296568") + .setValidateOnly(true) + .build(); + OperationFuture future = + jobsClient.createJobOperationCallable().futureCall(request); + // Do something. + Job response = future.get(); + } + } +} +// [END run_v2_generated_Jobs_CreateJob_LRO_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/SyncCreateJob.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/SyncCreateJob.java new file mode 100644 index 000000000000..33fe6aea6135 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/SyncCreateJob.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.run.v2.samples; + +// [START run_v2_generated_Jobs_CreateJob_sync] +import com.google.cloud.run.v2.CreateJobRequest; +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.LocationName; + +public class SyncCreateJob { + + public static void main(String[] args) throws Exception { + syncCreateJob(); + } + + public static void syncCreateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + CreateJobRequest request = + CreateJobRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setJob(Job.newBuilder().build()) + .setJobId("jobId101296568") + .setValidateOnly(true) + .build(); + Job response = jobsClient.createJobAsync(request).get(); + } + } +} +// [END run_v2_generated_Jobs_CreateJob_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/SyncCreateJobLocationnameJobString.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/SyncCreateJobLocationnameJobString.java new file mode 100644 index 000000000000..b5e99dd1a6ef --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/SyncCreateJobLocationnameJobString.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.run.v2.samples; + +// [START run_v2_generated_Jobs_CreateJob_LocationnameJobString_sync] +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.LocationName; + +public class SyncCreateJobLocationnameJobString { + + public static void main(String[] args) throws Exception { + syncCreateJobLocationnameJobString(); + } + + public static void syncCreateJobLocationnameJobString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Job job = Job.newBuilder().build(); + String jobId = "jobId101296568"; + Job response = jobsClient.createJobAsync(parent, job, jobId).get(); + } + } +} +// [END run_v2_generated_Jobs_CreateJob_LocationnameJobString_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/SyncCreateJobStringJobString.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/SyncCreateJobStringJobString.java new file mode 100644 index 000000000000..da9962075282 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/createjob/SyncCreateJobStringJobString.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.run.v2.samples; + +// [START run_v2_generated_Jobs_CreateJob_StringJobString_sync] +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.LocationName; + +public class SyncCreateJobStringJobString { + + public static void main(String[] args) throws Exception { + syncCreateJobStringJobString(); + } + + public static void syncCreateJobStringJobString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Job job = Job.newBuilder().build(); + String jobId = "jobId101296568"; + Job response = jobsClient.createJobAsync(parent, job, jobId).get(); + } + } +} +// [END run_v2_generated_Jobs_CreateJob_StringJobString_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/AsyncDeleteJob.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/AsyncDeleteJob.java new file mode 100644 index 000000000000..600b400aef9e --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/AsyncDeleteJob.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.run.v2.samples; + +// [START run_v2_generated_Jobs_DeleteJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.run.v2.DeleteJobRequest; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; +import com.google.longrunning.Operation; + +public class AsyncDeleteJob { + + public static void main(String[] args) throws Exception { + asyncDeleteJob(); + } + + public static void asyncDeleteJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + DeleteJobRequest request = + DeleteJobRequest.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + ApiFuture future = jobsClient.deleteJobCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END run_v2_generated_Jobs_DeleteJob_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/AsyncDeleteJobLRO.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/AsyncDeleteJobLRO.java new file mode 100644 index 000000000000..4e31c6885fbd --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/AsyncDeleteJobLRO.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.run.v2.samples; + +// [START run_v2_generated_Jobs_DeleteJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.run.v2.DeleteJobRequest; +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; + +public class AsyncDeleteJobLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteJobLRO(); + } + + public static void asyncDeleteJobLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + DeleteJobRequest request = + DeleteJobRequest.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + OperationFuture future = + jobsClient.deleteJobOperationCallable().futureCall(request); + // Do something. + Job response = future.get(); + } + } +} +// [END run_v2_generated_Jobs_DeleteJob_LRO_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/SyncDeleteJob.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/SyncDeleteJob.java new file mode 100644 index 000000000000..3cbabf954356 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/SyncDeleteJob.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.run.v2.samples; + +// [START run_v2_generated_Jobs_DeleteJob_sync] +import com.google.cloud.run.v2.DeleteJobRequest; +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; + +public class SyncDeleteJob { + + public static void main(String[] args) throws Exception { + syncDeleteJob(); + } + + public static void syncDeleteJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + DeleteJobRequest request = + DeleteJobRequest.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + Job response = jobsClient.deleteJobAsync(request).get(); + } + } +} +// [END run_v2_generated_Jobs_DeleteJob_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/SyncDeleteJobJobname.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/SyncDeleteJobJobname.java new file mode 100644 index 000000000000..045c9e310022 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/SyncDeleteJobJobname.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.run.v2.samples; + +// [START run_v2_generated_Jobs_DeleteJob_Jobname_sync] +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; + +public class SyncDeleteJobJobname { + + public static void main(String[] args) throws Exception { + syncDeleteJobJobname(); + } + + public static void syncDeleteJobJobname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + Job response = jobsClient.deleteJobAsync(name).get(); + } + } +} +// [END run_v2_generated_Jobs_DeleteJob_Jobname_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/SyncDeleteJobString.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/SyncDeleteJobString.java new file mode 100644 index 000000000000..e0527ecc8485 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/deletejob/SyncDeleteJobString.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.run.v2.samples; + +// [START run_v2_generated_Jobs_DeleteJob_String_sync] +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; + +public class SyncDeleteJobString { + + public static void main(String[] args) throws Exception { + syncDeleteJobString(); + } + + public static void syncDeleteJobString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString(); + Job response = jobsClient.deleteJobAsync(name).get(); + } + } +} +// [END run_v2_generated_Jobs_DeleteJob_String_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getiampolicy/AsyncGetIamPolicy.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getiampolicy/AsyncGetIamPolicy.java new file mode 100644 index 000000000000..ac0ca38cf2f7 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getiampolicy/AsyncGetIamPolicy.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.run.v2.samples; + +// [START run_v2_generated_Jobs_GetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class AsyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncGetIamPolicy(); + } + + public static void asyncGetIamPolicy() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + ApiFuture future = jobsClient.getIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END run_v2_generated_Jobs_GetIamPolicy_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getiampolicy/SyncGetIamPolicy.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getiampolicy/SyncGetIamPolicy.java new file mode 100644 index 000000000000..903beb2c0b63 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getiampolicy/SyncGetIamPolicy.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.run.v2.samples; + +// [START run_v2_generated_Jobs_GetIamPolicy_sync] +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.GetPolicyOptions; +import com.google.iam.v1.Policy; + +public class SyncGetIamPolicy { + + public static void main(String[] args) throws Exception { + syncGetIamPolicy(); + } + + public static void syncGetIamPolicy() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setOptions(GetPolicyOptions.newBuilder().build()) + .build(); + Policy response = jobsClient.getIamPolicy(request); + } + } +} +// [END run_v2_generated_Jobs_GetIamPolicy_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/AsyncGetJob.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/AsyncGetJob.java new file mode 100644 index 000000000000..c99b84d91b5e --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/AsyncGetJob.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.run.v2.samples; + +// [START run_v2_generated_Jobs_GetJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.run.v2.GetJobRequest; +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; + +public class AsyncGetJob { + + public static void main(String[] args) throws Exception { + asyncGetJob(); + } + + public static void asyncGetJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + GetJobRequest request = + GetJobRequest.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .build(); + ApiFuture future = jobsClient.getJobCallable().futureCall(request); + // Do something. + Job response = future.get(); + } + } +} +// [END run_v2_generated_Jobs_GetJob_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/SyncGetJob.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/SyncGetJob.java new file mode 100644 index 000000000000..aab7ae4b820f --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/SyncGetJob.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.run.v2.samples; + +// [START run_v2_generated_Jobs_GetJob_sync] +import com.google.cloud.run.v2.GetJobRequest; +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; + +public class SyncGetJob { + + public static void main(String[] args) throws Exception { + syncGetJob(); + } + + public static void syncGetJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + GetJobRequest request = + GetJobRequest.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .build(); + Job response = jobsClient.getJob(request); + } + } +} +// [END run_v2_generated_Jobs_GetJob_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/SyncGetJobJobname.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/SyncGetJobJobname.java new file mode 100644 index 000000000000..d5296ab01ddb --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/SyncGetJobJobname.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.run.v2.samples; + +// [START run_v2_generated_Jobs_GetJob_Jobname_sync] +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; + +public class SyncGetJobJobname { + + public static void main(String[] args) throws Exception { + syncGetJobJobname(); + } + + public static void syncGetJobJobname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + Job response = jobsClient.getJob(name); + } + } +} +// [END run_v2_generated_Jobs_GetJob_Jobname_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/SyncGetJobString.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/SyncGetJobString.java new file mode 100644 index 000000000000..0c85c36bc7e8 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/getjob/SyncGetJobString.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.run.v2.samples; + +// [START run_v2_generated_Jobs_GetJob_String_sync] +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; + +public class SyncGetJobString { + + public static void main(String[] args) throws Exception { + syncGetJobString(); + } + + public static void syncGetJobString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString(); + Job response = jobsClient.getJob(name); + } + } +} +// [END run_v2_generated_Jobs_GetJob_String_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/AsyncListJobs.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/AsyncListJobs.java new file mode 100644 index 000000000000..ba574a153895 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/AsyncListJobs.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.run.v2.samples; + +// [START run_v2_generated_Jobs_ListJobs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.ListJobsRequest; +import com.google.cloud.run.v2.LocationName; + +public class AsyncListJobs { + + public static void main(String[] args) throws Exception { + asyncListJobs(); + } + + public static void asyncListJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + ListJobsRequest request = + ListJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + ApiFuture future = jobsClient.listJobsPagedCallable().futureCall(request); + // Do something. + for (Job element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END run_v2_generated_Jobs_ListJobs_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/AsyncListJobsPaged.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/AsyncListJobsPaged.java new file mode 100644 index 000000000000..063d8e5b25f4 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/AsyncListJobsPaged.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.run.v2.samples; + +// [START run_v2_generated_Jobs_ListJobs_Paged_async] +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.ListJobsRequest; +import com.google.cloud.run.v2.ListJobsResponse; +import com.google.cloud.run.v2.LocationName; +import com.google.common.base.Strings; + +public class AsyncListJobsPaged { + + public static void main(String[] args) throws Exception { + asyncListJobsPaged(); + } + + public static void asyncListJobsPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + ListJobsRequest request = + ListJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + while (true) { + ListJobsResponse response = jobsClient.listJobsCallable().call(request); + for (Job element : response.getJobsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END run_v2_generated_Jobs_ListJobs_Paged_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/SyncListJobs.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/SyncListJobs.java new file mode 100644 index 000000000000..3e13545da3bc --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/SyncListJobs.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.run.v2.samples; + +// [START run_v2_generated_Jobs_ListJobs_sync] +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.ListJobsRequest; +import com.google.cloud.run.v2.LocationName; + +public class SyncListJobs { + + public static void main(String[] args) throws Exception { + syncListJobs(); + } + + public static void syncListJobs() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + ListJobsRequest request = + ListJobsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + for (Job element : jobsClient.listJobs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END run_v2_generated_Jobs_ListJobs_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/SyncListJobsLocationname.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/SyncListJobsLocationname.java new file mode 100644 index 000000000000..edb13a4d2564 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/SyncListJobsLocationname.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.run.v2.samples; + +// [START run_v2_generated_Jobs_ListJobs_Locationname_sync] +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.LocationName; + +public class SyncListJobsLocationname { + + public static void main(String[] args) throws Exception { + syncListJobsLocationname(); + } + + public static void syncListJobsLocationname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Job element : jobsClient.listJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END run_v2_generated_Jobs_ListJobs_Locationname_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/SyncListJobsString.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/SyncListJobsString.java new file mode 100644 index 000000000000..f500be80192c --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/listjobs/SyncListJobsString.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.run.v2.samples; + +// [START run_v2_generated_Jobs_ListJobs_String_sync] +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.LocationName; + +public class SyncListJobsString { + + public static void main(String[] args) throws Exception { + syncListJobsString(); + } + + public static void syncListJobsString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Job element : jobsClient.listJobs(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END run_v2_generated_Jobs_ListJobs_String_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/AsyncRunJob.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/AsyncRunJob.java new file mode 100644 index 000000000000..1ab38c233723 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/AsyncRunJob.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.run.v2.samples; + +// [START run_v2_generated_Jobs_RunJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.RunJobRequest; +import com.google.longrunning.Operation; + +public class AsyncRunJob { + + public static void main(String[] args) throws Exception { + asyncRunJob(); + } + + public static void asyncRunJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + RunJobRequest request = + RunJobRequest.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + ApiFuture future = jobsClient.runJobCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END run_v2_generated_Jobs_RunJob_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/AsyncRunJobLRO.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/AsyncRunJobLRO.java new file mode 100644 index 000000000000..75affb2b089b --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/AsyncRunJobLRO.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.run.v2.samples; + +// [START run_v2_generated_Jobs_RunJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.RunJobRequest; + +public class AsyncRunJobLRO { + + public static void main(String[] args) throws Exception { + asyncRunJobLRO(); + } + + public static void asyncRunJobLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + RunJobRequest request = + RunJobRequest.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + OperationFuture future = + jobsClient.runJobOperationCallable().futureCall(request); + // Do something. + Execution response = future.get(); + } + } +} +// [END run_v2_generated_Jobs_RunJob_LRO_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/SyncRunJob.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/SyncRunJob.java new file mode 100644 index 000000000000..798931a7c63b --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/SyncRunJob.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.run.v2.samples; + +// [START run_v2_generated_Jobs_RunJob_sync] +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.RunJobRequest; + +public class SyncRunJob { + + public static void main(String[] args) throws Exception { + syncRunJob(); + } + + public static void syncRunJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + RunJobRequest request = + RunJobRequest.newBuilder() + .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setValidateOnly(true) + .setEtag("etag3123477") + .build(); + Execution response = jobsClient.runJobAsync(request).get(); + } + } +} +// [END run_v2_generated_Jobs_RunJob_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/SyncRunJobJobname.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/SyncRunJobJobname.java new file mode 100644 index 000000000000..b9d17ca3382e --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/SyncRunJobJobname.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.run.v2.samples; + +// [START run_v2_generated_Jobs_RunJob_Jobname_sync] +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; + +public class SyncRunJobJobname { + + public static void main(String[] args) throws Exception { + syncRunJobJobname(); + } + + public static void syncRunJobJobname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); + Execution response = jobsClient.runJobAsync(name).get(); + } + } +} +// [END run_v2_generated_Jobs_RunJob_Jobname_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/SyncRunJobString.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/SyncRunJobString.java new file mode 100644 index 000000000000..cb4c62c99e17 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/runjob/SyncRunJobString.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.run.v2.samples; + +// [START run_v2_generated_Jobs_RunJob_String_sync] +import com.google.cloud.run.v2.Execution; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; + +public class SyncRunJobString { + + public static void main(String[] args) throws Exception { + syncRunJobString(); + } + + public static void syncRunJobString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString(); + Execution response = jobsClient.runJobAsync(name).get(); + } + } +} +// [END run_v2_generated_Jobs_RunJob_String_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/setiampolicy/AsyncSetIamPolicy.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/setiampolicy/AsyncSetIamPolicy.java new file mode 100644 index 000000000000..55fcf3ba1f98 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/setiampolicy/AsyncSetIamPolicy.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.run.v2.samples; + +// [START run_v2_generated_Jobs_SetIamPolicy_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class AsyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + asyncSetIamPolicy(); + } + + public static void asyncSetIamPolicy() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = jobsClient.setIamPolicyCallable().futureCall(request); + // Do something. + Policy response = future.get(); + } + } +} +// [END run_v2_generated_Jobs_SetIamPolicy_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/setiampolicy/SyncSetIamPolicy.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/setiampolicy/SyncSetIamPolicy.java new file mode 100644 index 000000000000..8271441ced54 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/setiampolicy/SyncSetIamPolicy.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.run.v2.samples; + +// [START run_v2_generated_Jobs_SetIamPolicy_sync] +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.protobuf.FieldMask; + +public class SyncSetIamPolicy { + + public static void main(String[] args) throws Exception { + syncSetIamPolicy(); + } + + public static void syncSetIamPolicy() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .setPolicy(Policy.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Policy response = jobsClient.setIamPolicy(request); + } + } +} +// [END run_v2_generated_Jobs_SetIamPolicy_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/testiampermissions/AsyncTestIamPermissions.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/testiampermissions/AsyncTestIamPermissions.java new file mode 100644 index 000000000000..d978bebf3c9b --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/testiampermissions/AsyncTestIamPermissions.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.run.v2.samples; + +// [START run_v2_generated_Jobs_TestIamPermissions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class AsyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + asyncTestIamPermissions(); + } + + public static void asyncTestIamPermissions() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + ApiFuture future = + jobsClient.testIamPermissionsCallable().futureCall(request); + // Do something. + TestIamPermissionsResponse response = future.get(); + } + } +} +// [END run_v2_generated_Jobs_TestIamPermissions_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/testiampermissions/SyncTestIamPermissions.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/testiampermissions/SyncTestIamPermissions.java new file mode 100644 index 000000000000..3ab4d802a19a --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/testiampermissions/SyncTestIamPermissions.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.run.v2.samples; + +// [START run_v2_generated_Jobs_TestIamPermissions_sync] +import com.google.cloud.run.v2.JobName; +import com.google.cloud.run.v2.JobsClient; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.util.ArrayList; + +public class SyncTestIamPermissions { + + public static void main(String[] args) throws Exception { + syncTestIamPermissions(); + } + + public static void syncTestIamPermissions() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + .addAllPermissions(new ArrayList()) + .build(); + TestIamPermissionsResponse response = jobsClient.testIamPermissions(request); + } + } +} +// [END run_v2_generated_Jobs_TestIamPermissions_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/AsyncUpdateJob.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/AsyncUpdateJob.java new file mode 100644 index 000000000000..b316f1fc31a6 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/AsyncUpdateJob.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.run.v2.samples; + +// [START run_v2_generated_Jobs_UpdateJob_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.UpdateJobRequest; +import com.google.longrunning.Operation; + +public class AsyncUpdateJob { + + public static void main(String[] args) throws Exception { + asyncUpdateJob(); + } + + public static void asyncUpdateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + UpdateJobRequest request = + UpdateJobRequest.newBuilder() + .setJob(Job.newBuilder().build()) + .setValidateOnly(true) + .setAllowMissing(true) + .build(); + ApiFuture future = jobsClient.updateJobCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END run_v2_generated_Jobs_UpdateJob_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/AsyncUpdateJobLRO.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/AsyncUpdateJobLRO.java new file mode 100644 index 000000000000..d248405b94b0 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/AsyncUpdateJobLRO.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.run.v2.samples; + +// [START run_v2_generated_Jobs_UpdateJob_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.UpdateJobRequest; + +public class AsyncUpdateJobLRO { + + public static void main(String[] args) throws Exception { + asyncUpdateJobLRO(); + } + + public static void asyncUpdateJobLRO() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + UpdateJobRequest request = + UpdateJobRequest.newBuilder() + .setJob(Job.newBuilder().build()) + .setValidateOnly(true) + .setAllowMissing(true) + .build(); + OperationFuture future = + jobsClient.updateJobOperationCallable().futureCall(request); + // Do something. + Job response = future.get(); + } + } +} +// [END run_v2_generated_Jobs_UpdateJob_LRO_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/SyncUpdateJob.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/SyncUpdateJob.java new file mode 100644 index 000000000000..de055f00c093 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/SyncUpdateJob.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.run.v2.samples; + +// [START run_v2_generated_Jobs_UpdateJob_sync] +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobsClient; +import com.google.cloud.run.v2.UpdateJobRequest; + +public class SyncUpdateJob { + + public static void main(String[] args) throws Exception { + syncUpdateJob(); + } + + public static void syncUpdateJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + UpdateJobRequest request = + UpdateJobRequest.newBuilder() + .setJob(Job.newBuilder().build()) + .setValidateOnly(true) + .setAllowMissing(true) + .build(); + Job response = jobsClient.updateJobAsync(request).get(); + } + } +} +// [END run_v2_generated_Jobs_UpdateJob_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/SyncUpdateJobJob.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/SyncUpdateJobJob.java new file mode 100644 index 000000000000..138ad0ae609a --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobs/updatejob/SyncUpdateJobJob.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.run.v2.samples; + +// [START run_v2_generated_Jobs_UpdateJob_Job_sync] +import com.google.cloud.run.v2.Job; +import com.google.cloud.run.v2.JobsClient; + +public class SyncUpdateJobJob { + + public static void main(String[] args) throws Exception { + syncUpdateJobJob(); + } + + public static void syncUpdateJobJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (JobsClient jobsClient = JobsClient.create()) { + Job job = Job.newBuilder().build(); + Job response = jobsClient.updateJobAsync(job).get(); + } + } +} +// [END run_v2_generated_Jobs_UpdateJob_Job_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobssettings/getjob/SyncGetJob.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobssettings/getjob/SyncGetJob.java new file mode 100644 index 000000000000..69db48da66eb --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/jobssettings/getjob/SyncGetJob.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.run.v2.samples; + +// [START run_v2_generated_JobsSettings_GetJob_sync] +import com.google.cloud.run.v2.JobsSettings; +import java.time.Duration; + +public class SyncGetJob { + + public static void main(String[] args) throws Exception { + syncGetJob(); + } + + public static void syncGetJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + JobsSettings.Builder jobsSettingsBuilder = JobsSettings.newBuilder(); + jobsSettingsBuilder + .getJobSettings() + .setRetrySettings( + jobsSettingsBuilder.getJobSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + JobsSettings jobsSettings = jobsSettingsBuilder.build(); + } +} +// [END run_v2_generated_JobsSettings_GetJob_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/stub/executionsstubsettings/getexecution/SyncGetExecution.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/stub/executionsstubsettings/getexecution/SyncGetExecution.java new file mode 100644 index 000000000000..83ba95ec8676 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/stub/executionsstubsettings/getexecution/SyncGetExecution.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.run.v2.stub.samples; + +// [START run_v2_generated_ExecutionsStubSettings_GetExecution_sync] +import com.google.cloud.run.v2.stub.ExecutionsStubSettings; +import java.time.Duration; + +public class SyncGetExecution { + + public static void main(String[] args) throws Exception { + syncGetExecution(); + } + + public static void syncGetExecution() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + ExecutionsStubSettings.Builder executionsSettingsBuilder = ExecutionsStubSettings.newBuilder(); + executionsSettingsBuilder + .getExecutionSettings() + .setRetrySettings( + executionsSettingsBuilder.getExecutionSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ExecutionsStubSettings executionsSettings = executionsSettingsBuilder.build(); + } +} +// [END run_v2_generated_ExecutionsStubSettings_GetExecution_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/stub/jobsstubsettings/getjob/SyncGetJob.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/stub/jobsstubsettings/getjob/SyncGetJob.java new file mode 100644 index 000000000000..fa5fd3b6e955 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/stub/jobsstubsettings/getjob/SyncGetJob.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.run.v2.stub.samples; + +// [START run_v2_generated_JobsStubSettings_GetJob_sync] +import com.google.cloud.run.v2.stub.JobsStubSettings; +import java.time.Duration; + +public class SyncGetJob { + + public static void main(String[] args) throws Exception { + syncGetJob(); + } + + public static void syncGetJob() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + JobsStubSettings.Builder jobsSettingsBuilder = JobsStubSettings.newBuilder(); + jobsSettingsBuilder + .getJobSettings() + .setRetrySettings( + jobsSettingsBuilder.getJobSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + JobsStubSettings jobsSettings = jobsSettingsBuilder.build(); + } +} +// [END run_v2_generated_JobsStubSettings_GetJob_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/stub/tasksstubsettings/gettask/SyncGetTask.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/stub/tasksstubsettings/gettask/SyncGetTask.java new file mode 100644 index 000000000000..a3bbe74f0293 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/stub/tasksstubsettings/gettask/SyncGetTask.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.run.v2.stub.samples; + +// [START run_v2_generated_TasksStubSettings_GetTask_sync] +import com.google.cloud.run.v2.stub.TasksStubSettings; +import java.time.Duration; + +public class SyncGetTask { + + public static void main(String[] args) throws Exception { + syncGetTask(); + } + + public static void syncGetTask() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TasksStubSettings.Builder tasksSettingsBuilder = TasksStubSettings.newBuilder(); + tasksSettingsBuilder + .getTaskSettings() + .setRetrySettings( + tasksSettingsBuilder.getTaskSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TasksStubSettings tasksSettings = tasksSettingsBuilder.build(); + } +} +// [END run_v2_generated_TasksStubSettings_GetTask_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/create/SyncCreateSetCredentialsProvider.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..52ab9c54bd3b --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/create/SyncCreateSetCredentialsProvider.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.run.v2.samples; + +// [START run_v2_generated_Tasks_Create_SetCredentialsProvider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.run.v2.TasksClient; +import com.google.cloud.run.v2.TasksSettings; +import com.google.cloud.run.v2.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 and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TasksSettings tasksSettings = + TasksSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + TasksClient tasksClient = TasksClient.create(tasksSettings); + } +} +// [END run_v2_generated_Tasks_Create_SetCredentialsProvider_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/create/SyncCreateSetCredentialsProvider1.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 000000000000..b73a00a7b95c --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/create/SyncCreateSetCredentialsProvider1.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.run.v2.samples; + +// [START run_v2_generated_Tasks_Create_SetCredentialsProvider1_sync] +import com.google.cloud.run.v2.TasksClient; +import com.google.cloud.run.v2.TasksSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TasksSettings tasksSettings = TasksSettings.newHttpJsonBuilder().build(); + TasksClient tasksClient = TasksClient.create(tasksSettings); + } +} +// [END run_v2_generated_Tasks_Create_SetCredentialsProvider1_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/create/SyncCreateSetEndpoint.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..52394c849e01 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/create/SyncCreateSetEndpoint.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.run.v2.samples; + +// [START run_v2_generated_Tasks_Create_SetEndpoint_sync] +import com.google.cloud.run.v2.TasksClient; +import com.google.cloud.run.v2.TasksSettings; +import com.google.cloud.run.v2.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 and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TasksSettings tasksSettings = TasksSettings.newBuilder().setEndpoint(myEndpoint).build(); + TasksClient tasksClient = TasksClient.create(tasksSettings); + } +} +// [END run_v2_generated_Tasks_Create_SetEndpoint_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/AsyncGetTask.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/AsyncGetTask.java new file mode 100644 index 000000000000..a0a403693ca7 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/AsyncGetTask.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.run.v2.samples; + +// [START run_v2_generated_Tasks_GetTask_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.run.v2.GetTaskRequest; +import com.google.cloud.run.v2.Task; +import com.google.cloud.run.v2.TaskName; +import com.google.cloud.run.v2.TasksClient; + +public class AsyncGetTask { + + public static void main(String[] args) throws Exception { + asyncGetTask(); + } + + public static void asyncGetTask() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TasksClient tasksClient = TasksClient.create()) { + GetTaskRequest request = + GetTaskRequest.newBuilder() + .setName( + TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]") + .toString()) + .build(); + ApiFuture future = tasksClient.getTaskCallable().futureCall(request); + // Do something. + Task response = future.get(); + } + } +} +// [END run_v2_generated_Tasks_GetTask_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/SyncGetTask.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/SyncGetTask.java new file mode 100644 index 000000000000..21d37364789a --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/SyncGetTask.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.run.v2.samples; + +// [START run_v2_generated_Tasks_GetTask_sync] +import com.google.cloud.run.v2.GetTaskRequest; +import com.google.cloud.run.v2.Task; +import com.google.cloud.run.v2.TaskName; +import com.google.cloud.run.v2.TasksClient; + +public class SyncGetTask { + + public static void main(String[] args) throws Exception { + syncGetTask(); + } + + public static void syncGetTask() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TasksClient tasksClient = TasksClient.create()) { + GetTaskRequest request = + GetTaskRequest.newBuilder() + .setName( + TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]") + .toString()) + .build(); + Task response = tasksClient.getTask(request); + } + } +} +// [END run_v2_generated_Tasks_GetTask_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/SyncGetTaskString.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/SyncGetTaskString.java new file mode 100644 index 000000000000..f6896e4c7708 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/SyncGetTaskString.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.run.v2.samples; + +// [START run_v2_generated_Tasks_GetTask_String_sync] +import com.google.cloud.run.v2.Task; +import com.google.cloud.run.v2.TaskName; +import com.google.cloud.run.v2.TasksClient; + +public class SyncGetTaskString { + + public static void main(String[] args) throws Exception { + syncGetTaskString(); + } + + public static void syncGetTaskString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TasksClient tasksClient = TasksClient.create()) { + String name = + TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]").toString(); + Task response = tasksClient.getTask(name); + } + } +} +// [END run_v2_generated_Tasks_GetTask_String_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/SyncGetTaskTaskname.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/SyncGetTaskTaskname.java new file mode 100644 index 000000000000..27e71e694289 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/gettask/SyncGetTaskTaskname.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.run.v2.samples; + +// [START run_v2_generated_Tasks_GetTask_Taskname_sync] +import com.google.cloud.run.v2.Task; +import com.google.cloud.run.v2.TaskName; +import com.google.cloud.run.v2.TasksClient; + +public class SyncGetTaskTaskname { + + public static void main(String[] args) throws Exception { + syncGetTaskTaskname(); + } + + public static void syncGetTaskTaskname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TasksClient tasksClient = TasksClient.create()) { + TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]", "[TASK]"); + Task response = tasksClient.getTask(name); + } + } +} +// [END run_v2_generated_Tasks_GetTask_Taskname_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/AsyncListTasks.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/AsyncListTasks.java new file mode 100644 index 000000000000..6cb973eb7659 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/AsyncListTasks.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.run.v2.samples; + +// [START run_v2_generated_Tasks_ListTasks_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.run.v2.ExecutionName; +import com.google.cloud.run.v2.ListTasksRequest; +import com.google.cloud.run.v2.Task; +import com.google.cloud.run.v2.TasksClient; + +public class AsyncListTasks { + + public static void main(String[] args) throws Exception { + asyncListTasks(); + } + + public static void asyncListTasks() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TasksClient tasksClient = TasksClient.create()) { + ListTasksRequest request = + ListTasksRequest.newBuilder() + .setParent( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + ApiFuture future = tasksClient.listTasksPagedCallable().futureCall(request); + // Do something. + for (Task element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END run_v2_generated_Tasks_ListTasks_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/AsyncListTasksPaged.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/AsyncListTasksPaged.java new file mode 100644 index 000000000000..3850808a0312 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/AsyncListTasksPaged.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.run.v2.samples; + +// [START run_v2_generated_Tasks_ListTasks_Paged_async] +import com.google.cloud.run.v2.ExecutionName; +import com.google.cloud.run.v2.ListTasksRequest; +import com.google.cloud.run.v2.ListTasksResponse; +import com.google.cloud.run.v2.Task; +import com.google.cloud.run.v2.TasksClient; +import com.google.common.base.Strings; + +public class AsyncListTasksPaged { + + public static void main(String[] args) throws Exception { + asyncListTasksPaged(); + } + + public static void asyncListTasksPaged() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TasksClient tasksClient = TasksClient.create()) { + ListTasksRequest request = + ListTasksRequest.newBuilder() + .setParent( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + while (true) { + ListTasksResponse response = tasksClient.listTasksCallable().call(request); + for (Task element : response.getTasksList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END run_v2_generated_Tasks_ListTasks_Paged_async] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/SyncListTasks.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/SyncListTasks.java new file mode 100644 index 000000000000..f7f5e7c75e89 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/SyncListTasks.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.run.v2.samples; + +// [START run_v2_generated_Tasks_ListTasks_sync] +import com.google.cloud.run.v2.ExecutionName; +import com.google.cloud.run.v2.ListTasksRequest; +import com.google.cloud.run.v2.Task; +import com.google.cloud.run.v2.TasksClient; + +public class SyncListTasks { + + public static void main(String[] args) throws Exception { + syncListTasks(); + } + + public static void syncListTasks() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TasksClient tasksClient = TasksClient.create()) { + ListTasksRequest request = + ListTasksRequest.newBuilder() + .setParent( + ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + for (Task element : tasksClient.listTasks(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END run_v2_generated_Tasks_ListTasks_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/SyncListTasksExecutionname.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/SyncListTasksExecutionname.java new file mode 100644 index 000000000000..01be43bf3c4c --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/SyncListTasksExecutionname.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.run.v2.samples; + +// [START run_v2_generated_Tasks_ListTasks_Executionname_sync] +import com.google.cloud.run.v2.ExecutionName; +import com.google.cloud.run.v2.Task; +import com.google.cloud.run.v2.TasksClient; + +public class SyncListTasksExecutionname { + + public static void main(String[] args) throws Exception { + syncListTasksExecutionname(); + } + + public static void syncListTasksExecutionname() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TasksClient tasksClient = TasksClient.create()) { + ExecutionName parent = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]"); + for (Task element : tasksClient.listTasks(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END run_v2_generated_Tasks_ListTasks_Executionname_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/SyncListTasksString.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/SyncListTasksString.java new file mode 100644 index 000000000000..029394a4028a --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/tasks/listtasks/SyncListTasksString.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.run.v2.samples; + +// [START run_v2_generated_Tasks_ListTasks_String_sync] +import com.google.cloud.run.v2.ExecutionName; +import com.google.cloud.run.v2.Task; +import com.google.cloud.run.v2.TasksClient; + +public class SyncListTasksString { + + public static void main(String[] args) throws Exception { + syncListTasksString(); + } + + public static void syncListTasksString() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (TasksClient tasksClient = TasksClient.create()) { + String parent = + ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString(); + for (Task element : tasksClient.listTasks(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END run_v2_generated_Tasks_ListTasks_String_sync] diff --git a/java-run/samples/snippets/generated/com/google/cloud/run/v2/taskssettings/gettask/SyncGetTask.java b/java-run/samples/snippets/generated/com/google/cloud/run/v2/taskssettings/gettask/SyncGetTask.java new file mode 100644 index 000000000000..8c2e0c5b8299 --- /dev/null +++ b/java-run/samples/snippets/generated/com/google/cloud/run/v2/taskssettings/gettask/SyncGetTask.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.run.v2.samples; + +// [START run_v2_generated_TasksSettings_GetTask_sync] +import com.google.cloud.run.v2.TasksSettings; +import java.time.Duration; + +public class SyncGetTask { + + public static void main(String[] args) throws Exception { + syncGetTask(); + } + + public static void syncGetTask() throws Exception { + // This snippet has been automatically generated and should be regarded as a code template only. + // It will require modifications to work: + // - It may require correct/in-range values for request initialization. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + TasksSettings.Builder tasksSettingsBuilder = TasksSettings.newBuilder(); + tasksSettingsBuilder + .getTaskSettings() + .setRetrySettings( + tasksSettingsBuilder.getTaskSettings().getRetrySettings().toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + TasksSettings tasksSettings = tasksSettingsBuilder.build(); + } +} +// [END run_v2_generated_TasksSettings_GetTask_sync]