Skip to content

Commit 7743e30

Browse files
yoshi-automationbusunkim96
authored andcommitted
docs(scheduler): change docstring formatting, add API proto annotations (via synth) (#9459)
1 parent 8a7eb38 commit 7743e30

8 files changed

Lines changed: 235 additions & 172 deletions

File tree

scheduler/google/cloud/scheduler_v1/gapic/cloud_scheduler_client.py

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,7 @@ def list_jobs(
251251
... pass
252252
253253
Args:
254-
parent (str): Required.
255-
256-
The location name. For example:
254+
parent (str): Required. The location name. For example:
257255
``projects/PROJECT_ID/locations/LOCATION_ID``.
258256
page_size (int): The maximum number of resources contained in the
259257
underlying API response. If page streaming is performed per-
@@ -342,9 +340,7 @@ def get_job(
342340
>>> response = client.get_job(name)
343341
344342
Args:
345-
name (str): Required.
346-
347-
The job name. For example:
343+
name (str): Required. The job name. For example:
348344
``projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID``.
349345
retry (Optional[google.api_core.retry.Retry]): A retry object used
350346
to retry requests. If ``None`` is specified, requests will
@@ -418,16 +414,12 @@ def create_job(
418414
>>> response = client.create_job(parent, job)
419415
420416
Args:
421-
parent (str): Required.
422-
423-
The location name. For example:
417+
parent (str): Required. The location name. For example:
424418
``projects/PROJECT_ID/locations/LOCATION_ID``.
425-
job (Union[dict, ~google.cloud.scheduler_v1.types.Job]): Required.
426-
427-
The job to add. The user can optionally specify a name for the job in
428-
``name``. ``name`` cannot be the same as an existing job. If a name is
429-
not specified then the system will generate a random unique name that
430-
will be returned (``name``) in the response.
419+
job (Union[dict, ~google.cloud.scheduler_v1.types.Job]): Required. The job to add. The user can optionally specify a name for the
420+
job in ``name``. ``name`` cannot be the same as an existing job. If a
421+
name is not specified then the system will generate a random unique name
422+
that will be returned (``name``) in the response.
431423
432424
If a dict is provided, it must be of the same form as the protobuf
433425
message :class:`~google.cloud.scheduler_v1.types.Job`
@@ -512,9 +504,7 @@ def update_job(
512504
>>> response = client.update_job(job, update_mask)
513505
514506
Args:
515-
job (Union[dict, ~google.cloud.scheduler_v1.types.Job]): Required.
516-
517-
The new job properties. ``name`` must be specified.
507+
job (Union[dict, ~google.cloud.scheduler_v1.types.Job]): Required. The new job properties. ``name`` must be specified.
518508
519509
Output only fields cannot be modified using UpdateJob. Any value
520510
specified for an output only field will be ignored.
@@ -593,9 +583,7 @@ def delete_job(
593583
>>> client.delete_job(name)
594584
595585
Args:
596-
name (str): Required.
597-
598-
The job name. For example:
586+
name (str): Required. The job name. For example:
599587
``projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID``.
600588
retry (Optional[google.api_core.retry.Retry]): A retry object used
601589
to retry requests. If ``None`` is specified, requests will
@@ -667,9 +655,7 @@ def pause_job(
667655
>>> response = client.pause_job(name)
668656
669657
Args:
670-
name (str): Required.
671-
672-
The job name. For example:
658+
name (str): Required. The job name. For example:
673659
``projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID``.
674660
retry (Optional[google.api_core.retry.Retry]): A retry object used
675661
to retry requests. If ``None`` is specified, requests will
@@ -744,9 +730,7 @@ def resume_job(
744730
>>> response = client.resume_job(name)
745731
746732
Args:
747-
name (str): Required.
748-
749-
The job name. For example:
733+
name (str): Required. The job name. For example:
750734
``projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID``.
751735
retry (Optional[google.api_core.retry.Retry]): A retry object used
752736
to retry requests. If ``None`` is specified, requests will
@@ -819,9 +803,7 @@ def run_job(
819803
>>> response = client.run_job(name)
820804
821805
Args:
822-
name (str): Required.
823-
824-
The job name. For example:
806+
name (str): Required. The job name. For example:
825807
``projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID``.
826808
retry (Optional[google.api_core.retry.Retry]): A retry object used
827809
to retry requests. If ``None`` is specified, requests will

scheduler/google/cloud/scheduler_v1/proto/cloudscheduler.proto

Lines changed: 68 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ syntax = "proto3";
1818
package google.cloud.scheduler.v1;
1919

2020
import "google/api/annotations.proto";
21+
import "google/api/client.proto";
22+
import "google/api/field_behavior.proto";
2123
import "google/api/resource.proto";
2224
import "google/cloud/scheduler/v1/job.proto";
2325
import "google/protobuf/empty.proto";
@@ -32,18 +34,23 @@ option objc_class_prefix = "SCHEDULER";
3234
// The Cloud Scheduler API allows external entities to reliably
3335
// schedule asynchronous jobs.
3436
service CloudScheduler {
37+
option (google.api.default_host) = "cloudscheduler.googleapis.com";
38+
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
39+
3540
// Lists jobs.
3641
rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) {
3742
option (google.api.http) = {
3843
get: "/v1/{parent=projects/*/locations/*}/jobs"
3944
};
45+
option (google.api.method_signature) = "parent";
4046
}
4147

4248
// Gets a job.
4349
rpc GetJob(GetJobRequest) returns (Job) {
4450
option (google.api.http) = {
4551
get: "/v1/{name=projects/*/locations/*/jobs/*}"
4652
};
53+
option (google.api.method_signature) = "name";
4754
}
4855

4956
// Creates a job.
@@ -52,6 +59,7 @@ service CloudScheduler {
5259
post: "/v1/{parent=projects/*/locations/*}/jobs"
5360
body: "job"
5461
};
62+
option (google.api.method_signature) = "parent,job";
5563
}
5664

5765
// Updates a job.
@@ -68,13 +76,15 @@ service CloudScheduler {
6876
patch: "/v1/{job.name=projects/*/locations/*/jobs/*}"
6977
body: "job"
7078
};
79+
option (google.api.method_signature) = "job,update_mask";
7180
}
7281

7382
// Deletes a job.
7483
rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) {
7584
option (google.api.http) = {
7685
delete: "/v1/{name=projects/*/locations/*/jobs/*}"
7786
};
87+
option (google.api.method_signature) = "name";
7888
}
7989

8090
// Pauses a job.
@@ -89,6 +99,7 @@ service CloudScheduler {
8999
post: "/v1/{name=projects/*/locations/*/jobs/*}:pause"
90100
body: "*"
91101
};
102+
option (google.api.method_signature) = "name";
92103
}
93104

94105
// Resume a job.
@@ -102,6 +113,7 @@ service CloudScheduler {
102113
post: "/v1/{name=projects/*/locations/*/jobs/*}:resume"
103114
body: "*"
104115
};
116+
option (google.api.method_signature) = "name";
105117
}
106118

107119
// Forces a job to run now.
@@ -113,16 +125,20 @@ service CloudScheduler {
113125
post: "/v1/{name=projects/*/locations/*/jobs/*}:run"
114126
body: "*"
115127
};
128+
option (google.api.method_signature) = "name";
116129
}
117130
}
118131

119132
// Request message for listing jobs using [ListJobs][google.cloud.scheduler.v1.CloudScheduler.ListJobs].
120133
message ListJobsRequest {
121-
// Required.
122-
//
123-
// The location name. For example:
134+
// Required. The location name. For example:
124135
// `projects/PROJECT_ID/locations/LOCATION_ID`.
125-
string parent = 1;
136+
string parent = 1 [
137+
(google.api.field_behavior) = REQUIRED,
138+
(google.api.resource_reference) = {
139+
child_type: "locations.googleapis.com/Location"
140+
}
141+
];
126142

127143
// Requested page size.
128144
//
@@ -159,79 +175,94 @@ message ListJobsResponse {
159175

160176
// Request message for [GetJob][google.cloud.scheduler.v1.CloudScheduler.GetJob].
161177
message GetJobRequest {
162-
// Required.
163-
//
164-
// The job name. For example:
178+
// Required. The job name. For example:
165179
// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
166-
string name = 1;
180+
string name = 1 [
181+
(google.api.field_behavior) = REQUIRED,
182+
(google.api.resource_reference) = {
183+
type: "cloudscheduler.googleapis.com/Job"
184+
}
185+
];
167186
}
168187

169188
// Request message for [CreateJob][google.cloud.scheduler.v1.CloudScheduler.CreateJob].
170189
message CreateJobRequest {
171-
// Required.
172-
//
173-
// The location name. For example:
190+
// Required. The location name. For example:
174191
// `projects/PROJECT_ID/locations/LOCATION_ID`.
175-
string parent = 1;
192+
string parent = 1 [
193+
(google.api.field_behavior) = REQUIRED,
194+
(google.api.resource_reference) = {
195+
child_type: "locations.googleapis.com/Location"
196+
}
197+
];
176198

177-
// Required.
178-
//
179-
// The job to add. The user can optionally specify a name for the
199+
// Required. The job to add. The user can optionally specify a name for the
180200
// job in [name][google.cloud.scheduler.v1.Job.name]. [name][google.cloud.scheduler.v1.Job.name] cannot be the same as an
181201
// existing job. If a name is not specified then the system will
182202
// generate a random unique name that will be returned
183203
// ([name][google.cloud.scheduler.v1.Job.name]) in the response.
184-
Job job = 2;
204+
Job job = 2 [(google.api.field_behavior) = REQUIRED];
185205
}
186206

187207
// Request message for [UpdateJob][google.cloud.scheduler.v1.CloudScheduler.UpdateJob].
188208
message UpdateJobRequest {
189-
// Required.
190-
//
191-
// The new job properties. [name][google.cloud.scheduler.v1.Job.name] must be specified.
209+
// Required. The new job properties. [name][google.cloud.scheduler.v1.Job.name] must be specified.
192210
//
193211
// Output only fields cannot be modified using UpdateJob.
194212
// Any value specified for an output only field will be ignored.
195-
Job job = 1;
213+
Job job = 1 [(google.api.field_behavior) = REQUIRED];
196214

197215
// A mask used to specify which fields of the job are being updated.
198-
google.protobuf.FieldMask update_mask = 2;
216+
google.protobuf.FieldMask update_mask = 2
217+
[(google.api.field_behavior) = REQUIRED];
199218
}
200219

201220
// Request message for deleting a job using
202221
// [DeleteJob][google.cloud.scheduler.v1.CloudScheduler.DeleteJob].
203222
message DeleteJobRequest {
204-
// Required.
205-
//
206-
// The job name. For example:
223+
// Required. The job name. For example:
207224
// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
208-
string name = 1;
225+
string name = 1 [
226+
(google.api.field_behavior) = REQUIRED,
227+
(google.api.resource_reference) = {
228+
type: "cloudscheduler.googleapis.com/Job"
229+
}
230+
];
209231
}
210232

211233
// Request message for [PauseJob][google.cloud.scheduler.v1.CloudScheduler.PauseJob].
212234
message PauseJobRequest {
213-
// Required.
214-
//
215-
// The job name. For example:
235+
// Required. The job name. For example:
216236
// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
217-
string name = 1;
237+
string name = 1 [
238+
(google.api.field_behavior) = REQUIRED,
239+
(google.api.resource_reference) = {
240+
type: "cloudscheduler.googleapis.com/Job"
241+
}
242+
];
218243
}
219244

220245
// Request message for [ResumeJob][google.cloud.scheduler.v1.CloudScheduler.ResumeJob].
221246
message ResumeJobRequest {
222-
// Required.
223-
//
224-
// The job name. For example:
247+
// Required. The job name. For example:
225248
// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
226-
string name = 1;
249+
string name = 1 [
250+
(google.api.field_behavior) = REQUIRED,
251+
(google.api.resource_reference) = {
252+
type: "cloudscheduler.googleapis.com/Job"
253+
}
254+
];
227255
}
228256

229257
// Request message for forcing a job to run now using
230258
// [RunJob][google.cloud.scheduler.v1.CloudScheduler.RunJob].
231259
message RunJobRequest {
232-
// Required.
233-
//
234-
// The job name. For example:
260+
// Required. The job name. For example:
235261
// `projects/PROJECT_ID/locations/LOCATION_ID/jobs/JOB_ID`.
236-
string name = 1;
262+
string name = 1 [
263+
(google.api.field_behavior) = REQUIRED,
264+
(google.api.resource_reference) = {
265+
type: "cloudscheduler.googleapis.com/Job"
266+
}
267+
];
237268
}

0 commit comments

Comments
 (0)