Skip to content

Commit 0a019bf

Browse files
committed
ran go generate
1 parent 8e75459 commit 0a019bf

File tree

2 files changed

+88
-36
lines changed

2 files changed

+88
-36
lines changed

doc/api-allowlist-schema.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,51 +26,51 @@ This document describes the schema for the API Allowlist.
2626

2727
| Field | Type | Description |
2828
| :--- | :--- | :--- |
29-
| `batched_field` | string | |
30-
| `discriminator_fields` | list of string | |
31-
| `subresponse_field` | string | |
29+
| `batched_field` | string | Is the request field whose values are combined when batching (e.g. "entries" in a logging API). |
30+
| `discriminator_fields` | list of string | Are request fields that must have identical values for requests to be batched together. |
31+
| `subresponse_field` | string | Is the response field that contains per-element results, used to split a batched response back to individual callers. |
3232

3333
## GAPICBatching Configuration
3434

3535
| Field | Type | Description |
3636
| :--- | :--- | :--- |
37-
| `thresholds` | [GAPICBatchingThresholds](#gapicbatchingthresholds-configuration) (optional) | |
38-
| `batch_descriptor` | [GAPICBatchDescriptor](#gapicbatchdescriptor-configuration) (optional) | |
37+
| `thresholds` | [GAPICBatchingThresholds](#gapicbatchingthresholds-configuration) (optional) | Defines the conditions that trigger a batch to be sent. |
38+
| `batch_descriptor` | [GAPICBatchDescriptor](#gapicbatchdescriptor-configuration) (optional) | Describes how individual requests are combined into a batch. |
3939

4040
## GAPICBatchingThresholds Configuration
4141

4242
| Field | Type | Description |
4343
| :--- | :--- | :--- |
44-
| `element_count_threshold` | int | |
45-
| `request_byte_threshold` | int | |
46-
| `delay_threshold_millis` | int | |
47-
| `flow_control_element_limit` | int | |
48-
| `flow_control_byte_limit` | int | |
49-
| `flow_control_limit_exceeded_behavior` | string | |
44+
| `element_count_threshold` | int | Is the number of elements that triggers a batch to be sent. |
45+
| `request_byte_threshold` | int | Is the total byte size of elements that triggers a batch to be sent. |
46+
| `delay_threshold_millis` | int | Is the maximum time to wait before sending a batch, in milliseconds. |
47+
| `flow_control_element_limit` | int | Is the maximum number of elements that may be outstanding at once. |
48+
| `flow_control_byte_limit` | int | Is the maximum total byte size of elements that may be outstanding at once. |
49+
| `flow_control_limit_exceeded_behavior` | string | Controls what happens when the flow control limit is exceeded (e.g. "ThrowException", "Block"). |
5050

5151
## GAPICInterface Configuration
5252

5353
| Field | Type | Description |
5454
| :--- | :--- | :--- |
55-
| `name` | string | |
56-
| `methods` | list of [GAPICMethod](#gapicmethod-configuration) | |
55+
| `name` | string | Is the fully-qualified name of the service interface (e.g. "google.cloud.speech.v1.Speech"). |
56+
| `methods` | list of [GAPICMethod](#gapicmethod-configuration) | Contains per-method configuration such as long-running operation polling and batching settings. |
5757

5858
## GAPICLongRunning Configuration
5959

6060
| Field | Type | Description |
6161
| :--- | :--- | :--- |
62-
| `initial_poll_delay_millis` | int64 | |
63-
| `poll_delay_multiplier` | float64 | |
64-
| `max_poll_delay_millis` | int64 | |
65-
| `total_poll_timeout_millis` | int64 | |
62+
| `initial_poll_delay_millis` | int64 | Is the delay before the first poll, in milliseconds. |
63+
| `poll_delay_multiplier` | float64 | Is the multiplier applied to the poll delay after each attempt. |
64+
| `max_poll_delay_millis` | int64 | Is the maximum poll delay, in milliseconds. |
65+
| `total_poll_timeout_millis` | int64 | Is the total time allowed for polling before the operation is considered timed out, in milliseconds. |
6666

6767
## GAPICMethod Configuration
6868

6969
| Field | Type | Description |
7070
| :--- | :--- | :--- |
71-
| `name` | string | |
72-
| `long_running` | [GAPICLongRunning](#gapiclongrunning-configuration) (optional) | |
73-
| `batching` | [GAPICBatching](#gapicbatching-configuration) (optional) | |
71+
| `name` | string | Is the simple method name (e.g. "LongRunningRecognize"). |
72+
| `long_running` | [GAPICLongRunning](#gapiclongrunning-configuration) (optional) | Contains polling configuration for long-running operations. Nil when the method is not long-running. |
73+
| `batching` | [GAPICBatching](#gapicbatching-configuration) (optional) | Contains request batching configuration. Nil when the method does not support batching. |
7474

7575
## GAPICYamlConfig Configuration
7676

internal/serviceconfig/gapic_yaml.go

Lines changed: 68 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,44 +36,96 @@ type GAPICYamlConfig struct {
3636
// GAPICInterface represents a service interface with method-level config
3737
// imported from *_gapic.yaml files in googleapis.
3838
type GAPICInterface struct {
39-
Name string `yaml:"name"`
39+
// Name is the fully-qualified name of the service interface
40+
// (e.g. "google.cloud.speech.v1.Speech").
41+
Name string `yaml:"name"`
42+
43+
// Methods contains per-method configuration such as long-running
44+
// operation polling and batching settings.
4045
Methods []GAPICMethod `yaml:"methods,omitempty"`
4146
}
4247

4348
// GAPICMethod represents method-level configuration from a gapic yaml file.
4449
type GAPICMethod struct {
45-
Name string `yaml:"name"`
50+
// Name is the simple method name (e.g. "LongRunningRecognize").
51+
Name string `yaml:"name"`
52+
53+
// LongRunning contains polling configuration for long-running
54+
// operations. Nil when the method is not long-running.
4655
LongRunning *GAPICLongRunning `yaml:"long_running,omitempty"`
47-
Batching *GAPICBatching `yaml:"batching,omitempty"`
56+
57+
// Batching contains request batching configuration. Nil when the
58+
// method does not support batching.
59+
Batching *GAPICBatching `yaml:"batching,omitempty"`
4860
}
4961

5062
// GAPICLongRunning contains polling configuration for long-running operations.
5163
type GAPICLongRunning struct {
52-
InitialPollDelayMillis int64 `yaml:"initial_poll_delay_millis,omitempty"`
53-
PollDelayMultiplier float64 `yaml:"poll_delay_multiplier,omitempty"`
54-
MaxPollDelayMillis int64 `yaml:"max_poll_delay_millis,omitempty"`
55-
TotalPollTimeoutMillis int64 `yaml:"total_poll_timeout_millis,omitempty"`
64+
// InitialPollDelayMillis is the delay before the first poll, in
65+
// milliseconds.
66+
InitialPollDelayMillis int64 `yaml:"initial_poll_delay_millis,omitempty"`
67+
68+
// PollDelayMultiplier is the multiplier applied to the poll delay
69+
// after each attempt.
70+
PollDelayMultiplier float64 `yaml:"poll_delay_multiplier,omitempty"`
71+
72+
// MaxPollDelayMillis is the maximum poll delay, in milliseconds.
73+
MaxPollDelayMillis int64 `yaml:"max_poll_delay_millis,omitempty"`
74+
75+
// TotalPollTimeoutMillis is the total time allowed for polling
76+
// before the operation is considered timed out, in milliseconds.
77+
TotalPollTimeoutMillis int64 `yaml:"total_poll_timeout_millis,omitempty"`
5678
}
5779

5880
// GAPICBatching contains request batching configuration.
5981
type GAPICBatching struct {
60-
Thresholds *GAPICBatchingThresholds `yaml:"thresholds,omitempty"`
61-
BatchDescriptor *GAPICBatchDescriptor `yaml:"batch_descriptor,omitempty"`
82+
// Thresholds defines the conditions that trigger a batch to be sent.
83+
Thresholds *GAPICBatchingThresholds `yaml:"thresholds,omitempty"`
84+
85+
// BatchDescriptor describes how individual requests are combined
86+
// into a batch.
87+
BatchDescriptor *GAPICBatchDescriptor `yaml:"batch_descriptor,omitempty"`
6288
}
6389

6490
// GAPICBatchingThresholds defines when batching should occur.
6591
type GAPICBatchingThresholds struct {
66-
ElementCountThreshold int `yaml:"element_count_threshold,omitempty"`
67-
RequestByteThreshold int `yaml:"request_byte_threshold,omitempty"`
68-
DelayThresholdMillis int `yaml:"delay_threshold_millis,omitempty"`
69-
FlowControlElementLimit int `yaml:"flow_control_element_limit,omitempty"`
70-
FlowControlByteLimit int `yaml:"flow_control_byte_limit,omitempty"`
92+
// ElementCountThreshold is the number of elements that triggers a
93+
// batch to be sent.
94+
ElementCountThreshold int `yaml:"element_count_threshold,omitempty"`
95+
96+
// RequestByteThreshold is the total byte size of elements that
97+
// triggers a batch to be sent.
98+
RequestByteThreshold int `yaml:"request_byte_threshold,omitempty"`
99+
100+
// DelayThresholdMillis is the maximum time to wait before sending a
101+
// batch, in milliseconds.
102+
DelayThresholdMillis int `yaml:"delay_threshold_millis,omitempty"`
103+
104+
// FlowControlElementLimit is the maximum number of elements that
105+
// may be outstanding at once.
106+
FlowControlElementLimit int `yaml:"flow_control_element_limit,omitempty"`
107+
108+
// FlowControlByteLimit is the maximum total byte size of elements
109+
// that may be outstanding at once.
110+
FlowControlByteLimit int `yaml:"flow_control_byte_limit,omitempty"`
111+
112+
// FlowControlLimitExceededBehavior controls what happens when the
113+
// flow control limit is exceeded (e.g. "ThrowException", "Block").
71114
FlowControlLimitExceededBehavior string `yaml:"flow_control_limit_exceeded_behavior,omitempty"`
72115
}
73116

74117
// GAPICBatchDescriptor describes how requests should be batched together.
75118
type GAPICBatchDescriptor struct {
76-
BatchedField string `yaml:"batched_field,omitempty"`
119+
// BatchedField is the request field whose values are combined when
120+
// batching (e.g. "entries" in a logging API).
121+
BatchedField string `yaml:"batched_field,omitempty"`
122+
123+
// DiscriminatorFields are request fields that must have identical
124+
// values for requests to be batched together.
77125
DiscriminatorFields []string `yaml:"discriminator_fields,omitempty"`
78-
SubresponseField string `yaml:"subresponse_field,omitempty"`
126+
127+
// SubresponseField is the response field that contains per-element
128+
// results, used to split a batched response back to individual
129+
// callers.
130+
SubresponseField string `yaml:"subresponse_field,omitempty"`
79131
}

0 commit comments

Comments
 (0)