From f8e4eadad4047f55fce453aec28865b14b5ac4eb Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot <44816363+yoshi-automation@users.noreply.github.com> Date: Mon, 13 May 2019 13:12:52 -0700 Subject: [PATCH] Add authorization headers and deadline for job attempts (via synth). (#7938) --- .../scheduler_v1/proto/cloudscheduler.proto | 2 +- .../scheduler_v1/proto/cloudscheduler_pb2.py | 44 +-- .../google/cloud/scheduler_v1/proto/job.proto | 14 +- .../cloud/scheduler_v1/proto/job_pb2.py | 49 ++- .../cloud/scheduler_v1/proto/target.proto | 59 +++- .../cloud/scheduler_v1/proto/target_pb2.py | 282 ++++++++++++++++-- scheduler/synth.metadata | 12 +- 7 files changed, 408 insertions(+), 54 deletions(-) diff --git a/scheduler/google/cloud/scheduler_v1/proto/cloudscheduler.proto b/scheduler/google/cloud/scheduler_v1/proto/cloudscheduler.proto index d12027a72554..a68446235c38 100644 --- a/scheduler/google/cloud/scheduler_v1/proto/cloudscheduler.proto +++ b/scheduler/google/cloud/scheduler_v1/proto/cloudscheduler.proto @@ -18,6 +18,7 @@ syntax = "proto3"; package google.cloud.scheduler.v1; import "google/api/annotations.proto"; +import "google/api/resource.proto"; import "google/cloud/scheduler/v1/job.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; @@ -28,7 +29,6 @@ option java_outer_classname = "SchedulerProto"; option java_package = "com.google.cloud.scheduler.v1"; option objc_class_prefix = "SCHEDULER"; - // The Cloud Scheduler API allows external entities to reliably // schedule asynchronous jobs. service CloudScheduler { diff --git a/scheduler/google/cloud/scheduler_v1/proto/cloudscheduler_pb2.py b/scheduler/google/cloud/scheduler_v1/proto/cloudscheduler_pb2.py index 6a57d2455ebd..8005ab09ca7b 100644 --- a/scheduler/google/cloud/scheduler_v1/proto/cloudscheduler_pb2.py +++ b/scheduler/google/cloud/scheduler_v1/proto/cloudscheduler_pb2.py @@ -15,6 +15,7 @@ from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 from google.cloud.scheduler_v1.proto import ( job_pb2 as google_dot_cloud_dot_scheduler__v1_dot_proto_dot_job__pb2, ) @@ -30,10 +31,11 @@ "\n\035com.google.cloud.scheduler.v1B\016SchedulerProtoP\001ZBgoogle.golang.org/genproto/googleapis/cloud/scheduler/v1;scheduler\242\002\tSCHEDULER" ), serialized_pb=_b( - '\n4google/cloud/scheduler_v1/proto/cloudscheduler.proto\x12\x19google.cloud.scheduler.v1\x1a\x1cgoogle/api/annotations.proto\x1a)google/cloud/scheduler_v1/proto/job.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto"H\n\x0fListJobsRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x05 \x01(\x05\x12\x12\n\npage_token\x18\x06 \x01(\t"Y\n\x10ListJobsResponse\x12,\n\x04jobs\x18\x01 \x03(\x0b\x32\x1e.google.cloud.scheduler.v1.Job\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"\x1d\n\rGetJobRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"O\n\x10\x43reateJobRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12+\n\x03job\x18\x02 \x01(\x0b\x32\x1e.google.cloud.scheduler.v1.Job"p\n\x10UpdateJobRequest\x12+\n\x03job\x18\x01 \x01(\x0b\x32\x1e.google.cloud.scheduler.v1.Job\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask" \n\x10\x44\x65leteJobRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"\x1f\n\x0fPauseJobRequest\x12\x0c\n\x04name\x18\x01 \x01(\t" \n\x10ResumeJobRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"\x1d\n\rRunJobRequest\x12\x0c\n\x04name\x18\x01 \x01(\t2\x95\t\n\x0e\x43loudScheduler\x12\x95\x01\n\x08ListJobs\x12*.google.cloud.scheduler.v1.ListJobsRequest\x1a+.google.cloud.scheduler.v1.ListJobsResponse"0\x82\xd3\xe4\x93\x02*\x12(/v1/{parent=projects/*/locations/*}/jobs\x12\x84\x01\n\x06GetJob\x12(.google.cloud.scheduler.v1.GetJobRequest\x1a\x1e.google.cloud.scheduler.v1.Job"0\x82\xd3\xe4\x93\x02*\x12(/v1/{name=projects/*/locations/*/jobs/*}\x12\x8f\x01\n\tCreateJob\x12+.google.cloud.scheduler.v1.CreateJobRequest\x1a\x1e.google.cloud.scheduler.v1.Job"5\x82\xd3\xe4\x93\x02/"(/v1/{parent=projects/*/locations/*}/jobs:\x03job\x12\x93\x01\n\tUpdateJob\x12+.google.cloud.scheduler.v1.UpdateJobRequest\x1a\x1e.google.cloud.scheduler.v1.Job"9\x82\xd3\xe4\x93\x02\x33\x32,/v1/{job.name=projects/*/locations/*/jobs/*}:\x03job\x12\x82\x01\n\tDeleteJob\x12+.google.cloud.scheduler.v1.DeleteJobRequest\x1a\x16.google.protobuf.Empty"0\x82\xd3\xe4\x93\x02**(/v1/{name=projects/*/locations/*/jobs/*}\x12\x91\x01\n\x08PauseJob\x12*.google.cloud.scheduler.v1.PauseJobRequest\x1a\x1e.google.cloud.scheduler.v1.Job"9\x82\xd3\xe4\x93\x02\x33"./v1/{name=projects/*/locations/*/jobs/*}:pause:\x01*\x12\x94\x01\n\tResumeJob\x12+.google.cloud.scheduler.v1.ResumeJobRequest\x1a\x1e.google.cloud.scheduler.v1.Job":\x82\xd3\xe4\x93\x02\x34"//v1/{name=projects/*/locations/*/jobs/*}:resume:\x01*\x12\x8b\x01\n\x06RunJob\x12(.google.cloud.scheduler.v1.RunJobRequest\x1a\x1e.google.cloud.scheduler.v1.Job"7\x82\xd3\xe4\x93\x02\x31",/v1/{name=projects/*/locations/*/jobs/*}:run:\x01*B\x81\x01\n\x1d\x63om.google.cloud.scheduler.v1B\x0eSchedulerProtoP\x01ZBgoogle.golang.org/genproto/googleapis/cloud/scheduler/v1;scheduler\xa2\x02\tSCHEDULERb\x06proto3' + '\n4google/cloud/scheduler_v1/proto/cloudscheduler.proto\x12\x19google.cloud.scheduler.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x19google/api/resource.proto\x1a)google/cloud/scheduler_v1/proto/job.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto"H\n\x0fListJobsRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x11\n\tpage_size\x18\x05 \x01(\x05\x12\x12\n\npage_token\x18\x06 \x01(\t"Y\n\x10ListJobsResponse\x12,\n\x04jobs\x18\x01 \x03(\x0b\x32\x1e.google.cloud.scheduler.v1.Job\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"\x1d\n\rGetJobRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"O\n\x10\x43reateJobRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12+\n\x03job\x18\x02 \x01(\x0b\x32\x1e.google.cloud.scheduler.v1.Job"p\n\x10UpdateJobRequest\x12+\n\x03job\x18\x01 \x01(\x0b\x32\x1e.google.cloud.scheduler.v1.Job\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask" \n\x10\x44\x65leteJobRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"\x1f\n\x0fPauseJobRequest\x12\x0c\n\x04name\x18\x01 \x01(\t" \n\x10ResumeJobRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"\x1d\n\rRunJobRequest\x12\x0c\n\x04name\x18\x01 \x01(\t2\x95\t\n\x0e\x43loudScheduler\x12\x95\x01\n\x08ListJobs\x12*.google.cloud.scheduler.v1.ListJobsRequest\x1a+.google.cloud.scheduler.v1.ListJobsResponse"0\x82\xd3\xe4\x93\x02*\x12(/v1/{parent=projects/*/locations/*}/jobs\x12\x84\x01\n\x06GetJob\x12(.google.cloud.scheduler.v1.GetJobRequest\x1a\x1e.google.cloud.scheduler.v1.Job"0\x82\xd3\xe4\x93\x02*\x12(/v1/{name=projects/*/locations/*/jobs/*}\x12\x8f\x01\n\tCreateJob\x12+.google.cloud.scheduler.v1.CreateJobRequest\x1a\x1e.google.cloud.scheduler.v1.Job"5\x82\xd3\xe4\x93\x02/"(/v1/{parent=projects/*/locations/*}/jobs:\x03job\x12\x93\x01\n\tUpdateJob\x12+.google.cloud.scheduler.v1.UpdateJobRequest\x1a\x1e.google.cloud.scheduler.v1.Job"9\x82\xd3\xe4\x93\x02\x33\x32,/v1/{job.name=projects/*/locations/*/jobs/*}:\x03job\x12\x82\x01\n\tDeleteJob\x12+.google.cloud.scheduler.v1.DeleteJobRequest\x1a\x16.google.protobuf.Empty"0\x82\xd3\xe4\x93\x02**(/v1/{name=projects/*/locations/*/jobs/*}\x12\x91\x01\n\x08PauseJob\x12*.google.cloud.scheduler.v1.PauseJobRequest\x1a\x1e.google.cloud.scheduler.v1.Job"9\x82\xd3\xe4\x93\x02\x33"./v1/{name=projects/*/locations/*/jobs/*}:pause:\x01*\x12\x94\x01\n\tResumeJob\x12+.google.cloud.scheduler.v1.ResumeJobRequest\x1a\x1e.google.cloud.scheduler.v1.Job":\x82\xd3\xe4\x93\x02\x34"//v1/{name=projects/*/locations/*/jobs/*}:resume:\x01*\x12\x8b\x01\n\x06RunJob\x12(.google.cloud.scheduler.v1.RunJobRequest\x1a\x1e.google.cloud.scheduler.v1.Job"7\x82\xd3\xe4\x93\x02\x31",/v1/{name=projects/*/locations/*/jobs/*}:run:\x01*B\x81\x01\n\x1d\x63om.google.cloud.scheduler.v1B\x0eSchedulerProtoP\x01ZBgoogle.golang.org/genproto/googleapis/cloud/scheduler/v1;scheduler\xa2\x02\tSCHEDULERb\x06proto3' ), dependencies=[ google_dot_api_dot_annotations__pb2.DESCRIPTOR, + google_dot_api_dot_resource__pb2.DESCRIPTOR, google_dot_cloud_dot_scheduler__v1_dot_proto_dot_job__pb2.DESCRIPTOR, google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, @@ -111,8 +113,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=219, - serialized_end=291, + serialized_start=246, + serialized_end=318, ) @@ -168,8 +170,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=293, - serialized_end=382, + serialized_start=320, + serialized_end=409, ) @@ -207,8 +209,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=384, - serialized_end=413, + serialized_start=411, + serialized_end=440, ) @@ -264,8 +266,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=415, - serialized_end=494, + serialized_start=442, + serialized_end=521, ) @@ -321,8 +323,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=496, - serialized_end=608, + serialized_start=523, + serialized_end=635, ) @@ -360,8 +362,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=610, - serialized_end=642, + serialized_start=637, + serialized_end=669, ) @@ -399,8 +401,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=644, - serialized_end=675, + serialized_start=671, + serialized_end=702, ) @@ -438,8 +440,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=677, - serialized_end=709, + serialized_start=704, + serialized_end=736, ) @@ -477,8 +479,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=711, - serialized_end=740, + serialized_start=738, + serialized_end=767, ) _LISTJOBSRESPONSE.fields_by_name[ @@ -730,8 +732,8 @@ file=DESCRIPTOR, index=0, serialized_options=None, - serialized_start=743, - serialized_end=1916, + serialized_start=770, + serialized_end=1943, methods=[ _descriptor.MethodDescriptor( name="ListJobs", diff --git a/scheduler/google/cloud/scheduler_v1/proto/job.proto b/scheduler/google/cloud/scheduler_v1/proto/job.proto index 8cf36c4d2c31..60b47263151b 100644 --- a/scheduler/google/cloud/scheduler_v1/proto/job.proto +++ b/scheduler/google/cloud/scheduler_v1/proto/job.proto @@ -18,6 +18,7 @@ syntax = "proto3"; package google.cloud.scheduler.v1; import "google/api/annotations.proto"; +import "google/api/resource.proto"; import "google/cloud/scheduler/v1/target.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; @@ -28,7 +29,6 @@ option java_multiple_files = true; option java_outer_classname = "JobProto"; option java_package = "com.google.cloud.scheduler.v1"; - // Configuration for a job. // The maximum allowed size for a job is 100KB. message Job { @@ -150,6 +150,18 @@ message Job { // Settings that determine the retry behavior. RetryConfig retry_config = 19; + + // The deadline for job attempts. If the request handler does not respond by + // this deadline then the request is cancelled and the attempt is marked as a + // `DEADLINE_EXCEEDED` failure. The failed attempt can be viewed in + // execution logs. Cloud Scheduler will retry the job according + // to the [RetryConfig][google.cloud.scheduler.v1.RetryConfig]. + // + // The allowed duration for this deadline is: + // * For [HTTP targets][google.cloud.scheduler.v1.Job.http_target], between 15 seconds and 30 minutes. + // * For [App Engine HTTP targets][google.cloud.scheduler.v1.Job.app_engine_http_target], between 15 + // seconds and 24 hours. + google.protobuf.Duration attempt_deadline = 22; } // Settings that determine the retry behavior. diff --git a/scheduler/google/cloud/scheduler_v1/proto/job_pb2.py b/scheduler/google/cloud/scheduler_v1/proto/job_pb2.py index a35907a101a8..54597913d8c3 100644 --- a/scheduler/google/cloud/scheduler_v1/proto/job_pb2.py +++ b/scheduler/google/cloud/scheduler_v1/proto/job_pb2.py @@ -15,6 +15,7 @@ from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 from google.cloud.scheduler_v1.proto import ( target_pb2 as google_dot_cloud_dot_scheduler__v1_dot_proto_dot_target__pb2, ) @@ -31,10 +32,11 @@ "\n\035com.google.cloud.scheduler.v1B\010JobProtoP\001ZBgoogle.golang.org/genproto/googleapis/cloud/scheduler/v1;scheduler" ), serialized_pb=_b( - '\n)google/cloud/scheduler_v1/proto/job.proto\x12\x19google.cloud.scheduler.v1\x1a\x1cgoogle/api/annotations.proto\x1a,google/cloud/scheduler_v1/proto/target.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto"\xba\x05\n\x03Job\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12@\n\rpubsub_target\x18\x04 \x01(\x0b\x32\'.google.cloud.scheduler.v1.PubsubTargetH\x00\x12P\n\x16\x61pp_engine_http_target\x18\x05 \x01(\x0b\x32..google.cloud.scheduler.v1.AppEngineHttpTargetH\x00\x12<\n\x0bhttp_target\x18\x06 \x01(\x0b\x32%.google.cloud.scheduler.v1.HttpTargetH\x00\x12\x10\n\x08schedule\x18\x14 \x01(\t\x12\x11\n\ttime_zone\x18\x15 \x01(\t\x12\x34\n\x10user_update_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x33\n\x05state\x18\n \x01(\x0e\x32$.google.cloud.scheduler.v1.Job.State\x12"\n\x06status\x18\x0b \x01(\x0b\x32\x12.google.rpc.Status\x12\x31\n\rschedule_time\x18\x11 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x35\n\x11last_attempt_time\x18\x12 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12<\n\x0cretry_config\x18\x13 \x01(\x0b\x32&.google.cloud.scheduler.v1.RetryConfig"X\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07\x45NABLED\x10\x01\x12\n\n\x06PAUSED\x10\x02\x12\x0c\n\x08\x44ISABLED\x10\x03\x12\x11\n\rUPDATE_FAILED\x10\x04\x42\x08\n\x06target"\xe2\x01\n\x0bRetryConfig\x12\x13\n\x0bretry_count\x18\x01 \x01(\x05\x12\x35\n\x12max_retry_duration\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14min_backoff_duration\x18\x03 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14max_backoff_duration\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x15\n\rmax_doublings\x18\x05 \x01(\x05\x42o\n\x1d\x63om.google.cloud.scheduler.v1B\x08JobProtoP\x01ZBgoogle.golang.org/genproto/googleapis/cloud/scheduler/v1;schedulerb\x06proto3' + '\n)google/cloud/scheduler_v1/proto/job.proto\x12\x19google.cloud.scheduler.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x19google/api/resource.proto\x1a,google/cloud/scheduler_v1/proto/target.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto"\xef\x05\n\x03Job\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12@\n\rpubsub_target\x18\x04 \x01(\x0b\x32\'.google.cloud.scheduler.v1.PubsubTargetH\x00\x12P\n\x16\x61pp_engine_http_target\x18\x05 \x01(\x0b\x32..google.cloud.scheduler.v1.AppEngineHttpTargetH\x00\x12<\n\x0bhttp_target\x18\x06 \x01(\x0b\x32%.google.cloud.scheduler.v1.HttpTargetH\x00\x12\x10\n\x08schedule\x18\x14 \x01(\t\x12\x11\n\ttime_zone\x18\x15 \x01(\t\x12\x34\n\x10user_update_time\x18\t \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x33\n\x05state\x18\n \x01(\x0e\x32$.google.cloud.scheduler.v1.Job.State\x12"\n\x06status\x18\x0b \x01(\x0b\x32\x12.google.rpc.Status\x12\x31\n\rschedule_time\x18\x11 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x35\n\x11last_attempt_time\x18\x12 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12<\n\x0cretry_config\x18\x13 \x01(\x0b\x32&.google.cloud.scheduler.v1.RetryConfig\x12\x33\n\x10\x61ttempt_deadline\x18\x16 \x01(\x0b\x32\x19.google.protobuf.Duration"X\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07\x45NABLED\x10\x01\x12\n\n\x06PAUSED\x10\x02\x12\x0c\n\x08\x44ISABLED\x10\x03\x12\x11\n\rUPDATE_FAILED\x10\x04\x42\x08\n\x06target"\xe2\x01\n\x0bRetryConfig\x12\x13\n\x0bretry_count\x18\x01 \x01(\x05\x12\x35\n\x12max_retry_duration\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14min_backoff_duration\x18\x03 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14max_backoff_duration\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x15\n\rmax_doublings\x18\x05 \x01(\x05\x42o\n\x1d\x63om.google.cloud.scheduler.v1B\x08JobProtoP\x01ZBgoogle.golang.org/genproto/googleapis/cloud/scheduler/v1;schedulerb\x06proto3' ), dependencies=[ google_dot_api_dot_annotations__pb2.DESCRIPTOR, + google_dot_api_dot_resource__pb2.DESCRIPTOR, google_dot_cloud_dot_scheduler__v1_dot_proto_dot_target__pb2.DESCRIPTOR, google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, @@ -71,8 +73,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=839, - serialized_end=927, + serialized_start=919, + serialized_end=1007, ) _sym_db.RegisterEnumDescriptor(_JOB_STATE) @@ -318,6 +320,24 @@ serialized_options=None, file=DESCRIPTOR, ), + _descriptor.FieldDescriptor( + name="attempt_deadline", + full_name="google.cloud.scheduler.v1.Job.attempt_deadline", + index=13, + number=22, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), ], extensions=[], nested_types=[], @@ -335,8 +355,8 @@ fields=[], ) ], - serialized_start=239, - serialized_end=937, + serialized_start=266, + serialized_end=1017, ) @@ -446,8 +466,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=940, - serialized_end=1166, + serialized_start=1020, + serialized_end=1246, ) _JOB.fields_by_name[ @@ -477,6 +497,9 @@ "last_attempt_time" ].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP _JOB.fields_by_name["retry_config"].message_type = _RETRYCONFIG +_JOB.fields_by_name[ + "attempt_deadline" +].message_type = google_dot_protobuf_dot_duration__pb2._DURATION _JOB_STATE.containing_type = _JOB _JOB.oneofs_by_name["target"].fields.append(_JOB.fields_by_name["pubsub_target"]) _JOB.fields_by_name["pubsub_target"].containing_oneof = _JOB.oneofs_by_name["target"] @@ -589,6 +612,18 @@ Output only. The time the last job attempt started. retry_config: Settings that determine the retry behavior. + attempt_deadline: + The deadline for job attempts. If the request handler does not + respond by this deadline then the request is cancelled and the + attempt is marked as a ``DEADLINE_EXCEEDED`` failure. The + failed attempt can be viewed in execution logs. Cloud + Scheduler will retry the job according to the + [RetryConfig][google.cloud.scheduler.v1.RetryConfig]. The + allowed duration for this deadline is: \* For [HTTP + targets][google.cloud.scheduler.v1.Job.http\_target], between + 15 seconds and 30 minutes. \* For [App Engine HTTP targets][go + ogle.cloud.scheduler.v1.Job.app\_engine\_http\_target], + between 15 seconds and 24 hours. """, # @@protoc_insertion_point(class_scope:google.cloud.scheduler.v1.Job) ), diff --git a/scheduler/google/cloud/scheduler_v1/proto/target.proto b/scheduler/google/cloud/scheduler_v1/proto/target.proto index 56de3b737e58..e33b1558e53d 100644 --- a/scheduler/google/cloud/scheduler_v1/proto/target.proto +++ b/scheduler/google/cloud/scheduler_v1/proto/target.proto @@ -25,7 +25,6 @@ option java_multiple_files = true; option java_outer_classname = "TargetProto"; option java_package = "com.google.cloud.scheduler.v1"; - // Http target. The job will be pushed to the job handler by means of // an HTTP request via an [http_method][google.cloud.scheduler.v1.HttpTarget.http_method] such as HTTP // POST, HTTP GET, etc. The job is acknowledged by means of an HTTP @@ -67,6 +66,30 @@ message HttpTarget { // method is POST, PUT, or PATCH. It is an error to set body on a job with an // incompatible [HttpMethod][google.cloud.scheduler.v1.HttpMethod]. bytes body = 4; + + // The mode for generating an `Authorization` header for HTTP requests. + // + // If specified, all `Authorization` headers in the [HttpTarget.headers][google.cloud.scheduler.v1.HttpTarget.headers] + // field will be overridden. + oneof authorization_header { + // If specified, an + // [OAuth token](https://developers.google.com/identity/protocols/OAuth2) + // will be generated and attached as an `Authorization` header in the HTTP + // request. + // + // This type of authorization should be used when sending requests to a GCP + // endpoint. + OAuthToken oauth_token = 5; + + // If specified, an + // [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect) + // token will be generated and attached as an `Authorization` header in the + // HTTP request. + // + // This type of authorization should be used when sending requests to third + // party endpoints or Cloud Run. + OidcToken oidc_token = 6; + } } // App Engine target. The job will be pushed to a job handler by means @@ -289,3 +312,37 @@ enum HttpMethod { // HTTP OPTIONS OPTIONS = 7; } + +// Contains information needed for generating an +// [OAuth token](https://developers.google.com/identity/protocols/OAuth2). +// This type of authorization should be used when sending requests to a GCP +// endpoint. +message OAuthToken { + // [Service account email](https://cloud.google.com/iam/docs/service-accounts) + // to be used for generating OAuth token. + // The service account must be within the same project as the job. The caller + // must have iam.serviceAccounts.actAs permission for the service account. + string service_account_email = 1; + + // OAuth scope to be used for generating OAuth access token. + // If not specified, "https://www.googleapis.com/auth/cloud-platform" + // will be used. + string scope = 2; +} + +// Contains information needed for generating an +// [OpenID Connect +// token](https://developers.google.com/identity/protocols/OpenIDConnect). This +// type of authorization should be used when sending requests to third party +// endpoints or Cloud Run. +message OidcToken { + // [Service account email](https://cloud.google.com/iam/docs/service-accounts) + // to be used for generating OIDC token. + // The service account must be within the same project as the job. The caller + // must have iam.serviceAccounts.actAs permission for the service account. + string service_account_email = 1; + + // Audience to be used when generating OIDC token. If not specified, the URI + // specified in target will be used. + string audience = 2; +} diff --git a/scheduler/google/cloud/scheduler_v1/proto/target_pb2.py b/scheduler/google/cloud/scheduler_v1/proto/target_pb2.py index 31c9be53a5c3..e89b444fbdfc 100644 --- a/scheduler/google/cloud/scheduler_v1/proto/target_pb2.py +++ b/scheduler/google/cloud/scheduler_v1/proto/target_pb2.py @@ -27,7 +27,7 @@ "\n\035com.google.cloud.scheduler.v1B\013TargetProtoP\001ZBgoogle.golang.org/genproto/googleapis/cloud/scheduler/v1;scheduler" ), serialized_pb=_b( - '\n,google/cloud/scheduler_v1/proto/target.proto\x12\x19google.cloud.scheduler.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x19google/protobuf/any.proto"\xd8\x01\n\nHttpTarget\x12\x0b\n\x03uri\x18\x01 \x01(\t\x12:\n\x0bhttp_method\x18\x02 \x01(\x0e\x32%.google.cloud.scheduler.v1.HttpMethod\x12\x43\n\x07headers\x18\x03 \x03(\x0b\x32\x32.google.cloud.scheduler.v1.HttpTarget.HeadersEntry\x12\x0c\n\x04\x62ody\x18\x04 \x01(\x0c\x1a.\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\xbc\x02\n\x13\x41ppEngineHttpTarget\x12:\n\x0bhttp_method\x18\x01 \x01(\x0e\x32%.google.cloud.scheduler.v1.HttpMethod\x12G\n\x12\x61pp_engine_routing\x18\x02 \x01(\x0b\x32+.google.cloud.scheduler.v1.AppEngineRouting\x12\x14\n\x0crelative_uri\x18\x03 \x01(\t\x12L\n\x07headers\x18\x04 \x03(\x0b\x32;.google.cloud.scheduler.v1.AppEngineHttpTarget.HeadersEntry\x12\x0c\n\x04\x62ody\x18\x05 \x01(\x0c\x1a.\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\xb0\x01\n\x0cPubsubTarget\x12\x12\n\ntopic_name\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\x12K\n\nattributes\x18\x04 \x03(\x0b\x32\x37.google.cloud.scheduler.v1.PubsubTarget.AttributesEntry\x1a\x31\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"T\n\x10\x41ppEngineRouting\x12\x0f\n\x07service\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t\x12\x10\n\x08instance\x18\x03 \x01(\t\x12\x0c\n\x04host\x18\x04 \x01(\t*s\n\nHttpMethod\x12\x1b\n\x17HTTP_METHOD_UNSPECIFIED\x10\x00\x12\x08\n\x04POST\x10\x01\x12\x07\n\x03GET\x10\x02\x12\x08\n\x04HEAD\x10\x03\x12\x07\n\x03PUT\x10\x04\x12\n\n\x06\x44\x45LETE\x10\x05\x12\t\n\x05PATCH\x10\x06\x12\x0b\n\x07OPTIONS\x10\x07\x42r\n\x1d\x63om.google.cloud.scheduler.v1B\x0bTargetProtoP\x01ZBgoogle.golang.org/genproto/googleapis/cloud/scheduler/v1;schedulerb\x06proto3' + '\n,google/cloud/scheduler_v1/proto/target.proto\x12\x19google.cloud.scheduler.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x19google/protobuf/any.proto"\xea\x02\n\nHttpTarget\x12\x0b\n\x03uri\x18\x01 \x01(\t\x12:\n\x0bhttp_method\x18\x02 \x01(\x0e\x32%.google.cloud.scheduler.v1.HttpMethod\x12\x43\n\x07headers\x18\x03 \x03(\x0b\x32\x32.google.cloud.scheduler.v1.HttpTarget.HeadersEntry\x12\x0c\n\x04\x62ody\x18\x04 \x01(\x0c\x12<\n\x0boauth_token\x18\x05 \x01(\x0b\x32%.google.cloud.scheduler.v1.OAuthTokenH\x00\x12:\n\noidc_token\x18\x06 \x01(\x0b\x32$.google.cloud.scheduler.v1.OidcTokenH\x00\x1a.\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x16\n\x14\x61uthorization_header"\xbc\x02\n\x13\x41ppEngineHttpTarget\x12:\n\x0bhttp_method\x18\x01 \x01(\x0e\x32%.google.cloud.scheduler.v1.HttpMethod\x12G\n\x12\x61pp_engine_routing\x18\x02 \x01(\x0b\x32+.google.cloud.scheduler.v1.AppEngineRouting\x12\x14\n\x0crelative_uri\x18\x03 \x01(\t\x12L\n\x07headers\x18\x04 \x03(\x0b\x32;.google.cloud.scheduler.v1.AppEngineHttpTarget.HeadersEntry\x12\x0c\n\x04\x62ody\x18\x05 \x01(\x0c\x1a.\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\xb0\x01\n\x0cPubsubTarget\x12\x12\n\ntopic_name\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\x12K\n\nattributes\x18\x04 \x03(\x0b\x32\x37.google.cloud.scheduler.v1.PubsubTarget.AttributesEntry\x1a\x31\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"T\n\x10\x41ppEngineRouting\x12\x0f\n\x07service\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t\x12\x10\n\x08instance\x18\x03 \x01(\t\x12\x0c\n\x04host\x18\x04 \x01(\t":\n\nOAuthToken\x12\x1d\n\x15service_account_email\x18\x01 \x01(\t\x12\r\n\x05scope\x18\x02 \x01(\t"<\n\tOidcToken\x12\x1d\n\x15service_account_email\x18\x01 \x01(\t\x12\x10\n\x08\x61udience\x18\x02 \x01(\t*s\n\nHttpMethod\x12\x1b\n\x17HTTP_METHOD_UNSPECIFIED\x10\x00\x12\x08\n\x04POST\x10\x01\x12\x07\n\x03GET\x10\x02\x12\x08\n\x04HEAD\x10\x03\x12\x07\n\x03PUT\x10\x04\x12\n\n\x06\x44\x45LETE\x10\x05\x12\t\n\x05PATCH\x10\x06\x12\x0b\n\x07OPTIONS\x10\x07\x42r\n\x1d\x63om.google.cloud.scheduler.v1B\x0bTargetProtoP\x01ZBgoogle.golang.org/genproto/googleapis/cloud/scheduler/v1;schedulerb\x06proto3' ), dependencies=[ google_dot_api_dot_annotations__pb2.DESCRIPTOR, @@ -72,8 +72,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=935, - serialized_end=1050, + serialized_start=1203, + serialized_end=1318, ) _sym_db.RegisterEnumDescriptor(_HTTPMETHOD) @@ -140,8 +140,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=303, - serialized_end=349, + serialized_start=425, + serialized_end=471, ) _HTTPTARGET = _descriptor.Descriptor( @@ -223,6 +223,42 @@ serialized_options=None, file=DESCRIPTOR, ), + _descriptor.FieldDescriptor( + name="oauth_token", + full_name="google.cloud.scheduler.v1.HttpTarget.oauth_token", + index=4, + number=5, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="oidc_token", + full_name="google.cloud.scheduler.v1.HttpTarget.oidc_token", + index=5, + number=6, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), ], extensions=[], nested_types=[_HTTPTARGET_HEADERSENTRY], @@ -231,9 +267,17 @@ is_extendable=False, syntax="proto3", extension_ranges=[], - oneofs=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="authorization_header", + full_name="google.cloud.scheduler.v1.HttpTarget.authorization_header", + index=0, + containing_type=None, + fields=[], + ) + ], serialized_start=133, - serialized_end=349, + serialized_end=495, ) @@ -289,8 +333,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=303, - serialized_end=349, + serialized_start=425, + serialized_end=471, ) _APPENGINEHTTPTARGET = _descriptor.Descriptor( @@ -399,8 +443,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=352, - serialized_end=668, + serialized_start=498, + serialized_end=814, ) @@ -456,8 +500,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=798, - serialized_end=847, + serialized_start=944, + serialized_end=993, ) _PUBSUBTARGET = _descriptor.Descriptor( @@ -530,8 +574,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=671, - serialized_end=847, + serialized_start=817, + serialized_end=993, ) @@ -623,13 +667,141 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=849, - serialized_end=933, + serialized_start=995, + serialized_end=1079, +) + + +_OAUTHTOKEN = _descriptor.Descriptor( + name="OAuthToken", + full_name="google.cloud.scheduler.v1.OAuthToken", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="service_account_email", + full_name="google.cloud.scheduler.v1.OAuthToken.service_account_email", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="scope", + full_name="google.cloud.scheduler.v1.OAuthToken.scope", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1081, + serialized_end=1139, +) + + +_OIDCTOKEN = _descriptor.Descriptor( + name="OidcToken", + full_name="google.cloud.scheduler.v1.OidcToken", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="service_account_email", + full_name="google.cloud.scheduler.v1.OidcToken.service_account_email", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="audience", + full_name="google.cloud.scheduler.v1.OidcToken.audience", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1141, + serialized_end=1201, ) _HTTPTARGET_HEADERSENTRY.containing_type = _HTTPTARGET _HTTPTARGET.fields_by_name["http_method"].enum_type = _HTTPMETHOD _HTTPTARGET.fields_by_name["headers"].message_type = _HTTPTARGET_HEADERSENTRY +_HTTPTARGET.fields_by_name["oauth_token"].message_type = _OAUTHTOKEN +_HTTPTARGET.fields_by_name["oidc_token"].message_type = _OIDCTOKEN +_HTTPTARGET.oneofs_by_name["authorization_header"].fields.append( + _HTTPTARGET.fields_by_name["oauth_token"] +) +_HTTPTARGET.fields_by_name["oauth_token"].containing_oneof = _HTTPTARGET.oneofs_by_name[ + "authorization_header" +] +_HTTPTARGET.oneofs_by_name["authorization_header"].fields.append( + _HTTPTARGET.fields_by_name["oidc_token"] +) +_HTTPTARGET.fields_by_name["oidc_token"].containing_oneof = _HTTPTARGET.oneofs_by_name[ + "authorization_header" +] _APPENGINEHTTPTARGET_HEADERSENTRY.containing_type = _APPENGINEHTTPTARGET _APPENGINEHTTPTARGET.fields_by_name["http_method"].enum_type = _HTTPMETHOD _APPENGINEHTTPTARGET.fields_by_name[ @@ -644,6 +816,8 @@ DESCRIPTOR.message_types_by_name["AppEngineHttpTarget"] = _APPENGINEHTTPTARGET DESCRIPTOR.message_types_by_name["PubsubTarget"] = _PUBSUBTARGET DESCRIPTOR.message_types_by_name["AppEngineRouting"] = _APPENGINEROUTING +DESCRIPTOR.message_types_by_name["OAuthToken"] = _OAUTHTOKEN +DESCRIPTOR.message_types_by_name["OidcToken"] = _OIDCTOKEN DESCRIPTOR.enum_types_by_name["HttpMethod"] = _HTTPMETHOD _sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -703,6 +877,23 @@ method is POST, PUT, or PATCH. It is an error to set body on a job with an incompatible [HttpMethod][google.cloud.scheduler.v1.HttpMethod]. + authorization_header: + The mode for generating an ``Authorization`` header for HTTP + requests. If specified, all ``Authorization`` headers in the + [HttpTarget.headers][google.cloud.scheduler.v1.HttpTarget.head + ers] field will be overridden. + oauth_token: + If specified, an `OAuth token + `__ + will be generated and attached as an ``Authorization`` header + in the HTTP request. This type of authorization should be + used when sending requests to a GCP endpoint. + oidc_token: + If specified, an `OIDC `__ token will be generated and + attached as an ``Authorization`` header in the HTTP request. + This type of authorization should be used when sending + requests to third party endpoints or Cloud Run. """, # @@protoc_insertion_point(class_scope:google.cloud.scheduler.v1.HttpTarget) ), @@ -924,6 +1115,63 @@ ) _sym_db.RegisterMessage(AppEngineRouting) +OAuthToken = _reflection.GeneratedProtocolMessageType( + "OAuthToken", + (_message.Message,), + dict( + DESCRIPTOR=_OAUTHTOKEN, + __module__="google.cloud.scheduler_v1.proto.target_pb2", + __doc__="""Contains information needed for generating an `OAuth + token `__. This + type of authorization should be used when sending requests to a GCP + endpoint. + + + Attributes: + service_account_email: + `Service account email + `__ to be + used for generating OAuth token. The service account must be + within the same project as the job. The caller must have + iam.serviceAccounts.actAs permission for the service account. + scope: + OAuth scope to be used for generating OAuth access token. If + not specified, "https://www.googleapis.com/auth/cloud- + platform" will be used. + """, + # @@protoc_insertion_point(class_scope:google.cloud.scheduler.v1.OAuthToken) + ), +) +_sym_db.RegisterMessage(OAuthToken) + +OidcToken = _reflection.GeneratedProtocolMessageType( + "OidcToken", + (_message.Message,), + dict( + DESCRIPTOR=_OIDCTOKEN, + __module__="google.cloud.scheduler_v1.proto.target_pb2", + __doc__="""Contains information needed for generating an `OpenID Connect + token `__. + This type of authorization should be used when sending requests to third + party endpoints or Cloud Run. + + + Attributes: + service_account_email: + `Service account email + `__ to be + used for generating OIDC token. The service account must be + within the same project as the job. The caller must have + iam.serviceAccounts.actAs permission for the service account. + audience: + Audience to be used when generating OIDC token. If not + specified, the URI specified in target will be used. + """, + # @@protoc_insertion_point(class_scope:google.cloud.scheduler.v1.OidcToken) + ), +) +_sym_db.RegisterMessage(OidcToken) + DESCRIPTOR._options = None _HTTPTARGET_HEADERSENTRY._options = None diff --git a/scheduler/synth.metadata b/scheduler/synth.metadata index 6fbb2a3c4636..978c14d42822 100644 --- a/scheduler/synth.metadata +++ b/scheduler/synth.metadata @@ -1,26 +1,26 @@ { - "updateTime": "2019-04-23T12:25:40.611010Z", + "updateTime": "2019-05-10T12:34:11.107805Z", "sources": [ { "generator": { "name": "artman", - "version": "0.17.0", - "dockerImage": "googleapis/artman@sha256:c58f4ec3838eb4e0718eb1bccc6512bd6850feaa85a360a9e38f6f848ec73bc2" + "version": "0.19.0", + "dockerImage": "googleapis/artman@sha256:d3df563538225ac6caac45d8ad86499500211d1bcb2536955a6dbda15e1b368e" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "547e19e7df398e9290e8e3674d7351efc500f9b0", - "internalRef": "244712781" + "sha": "07883be5bf3c3233095e99d8e92b8094f5d7084a", + "internalRef": "247530843" } }, { "template": { "name": "python_library", "origin": "synthtool.gcp", - "version": "2019.4.10" + "version": "2019.5.2" } } ],