Skip to content

Commit 9fdcec1

Browse files
feat(api): api update
1 parent 16f5c2a commit 9fdcec1

File tree

3 files changed

+188
-32
lines changed

3 files changed

+188
-32
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1752
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-07850c05f5faee9033ffe4970b3e0a2368458141d05da9b761a534f8195e6e6d.yml
3-
openapi_spec_hash: 69b3076f1524a788b18a81893fee1ee3
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-97074b550d93648f2a49d85826e270e6d8701c8f7995d398092d47b38a5617d5.yml
3+
openapi_spec_hash: e8767543491a9b3109cd30388421100b
44
config_hash: 284c4178d08f75d8c8b29f275948a8fd

logpush/job.go

Lines changed: 180 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -247,20 +247,18 @@ type LogpushJob struct {
247247
// The maximum uncompressed file size of a batch of logs. This setting value must
248248
// be between `5 MB` and `1 GB`, or `0` to disable it. Note that you cannot set a
249249
// minimum file size; this means that log files may be much smaller than this batch
250-
// size. This parameter is not available for jobs with `edge` as its kind.
251-
MaxUploadBytes int64 `json:"max_upload_bytes,nullable"`
250+
// size.
251+
MaxUploadBytes LogpushJobMaxUploadBytes `json:"max_upload_bytes,nullable"`
252252
// The maximum interval in seconds for log batches. This setting must be between 30
253253
// and 300 seconds (5 minutes), or `0` to disable it. Note that you cannot specify
254254
// a minimum interval for log batches; this means that log files may be sent in
255-
// shorter intervals than this. This parameter is only used for jobs with `edge` as
256-
// its kind.
257-
MaxUploadIntervalSeconds int64 `json:"max_upload_interval_seconds,nullable"`
255+
// shorter intervals than this.
256+
MaxUploadIntervalSeconds LogpushJobMaxUploadIntervalSeconds `json:"max_upload_interval_seconds,nullable"`
258257
// The maximum number of log lines per batch. This setting must be between 1000 and
259258
// 1,000,000 lines, or `0` to disable it. Note that you cannot specify a minimum
260259
// number of log lines per batch; this means that log files may contain many fewer
261-
// lines than this. This parameter is not available for jobs with `edge` as its
262-
// kind.
263-
MaxUploadRecords int64 `json:"max_upload_records,nullable"`
260+
// lines than this.
261+
MaxUploadRecords LogpushJobMaxUploadRecords `json:"max_upload_records,nullable"`
264262
// Optional human readable job name. Not unique. Cloudflare suggests that you set
265263
// this to a meaningful string, like the domain name, to make it easier to identify
266264
// your job.
@@ -375,6 +373,60 @@ func (r LogpushJobKind) IsKnown() bool {
375373
return false
376374
}
377375

376+
// The maximum uncompressed file size of a batch of logs. This setting value must
377+
// be between `5 MB` and `1 GB`, or `0` to disable it. Note that you cannot set a
378+
// minimum file size; this means that log files may be much smaller than this batch
379+
// size.
380+
type LogpushJobMaxUploadBytes float64
381+
382+
const (
383+
LogpushJobMaxUploadBytes0 LogpushJobMaxUploadBytes = 0
384+
)
385+
386+
func (r LogpushJobMaxUploadBytes) IsKnown() bool {
387+
switch r {
388+
case LogpushJobMaxUploadBytes0:
389+
return true
390+
}
391+
return false
392+
}
393+
394+
// The maximum interval in seconds for log batches. This setting must be between 30
395+
// and 300 seconds (5 minutes), or `0` to disable it. Note that you cannot specify
396+
// a minimum interval for log batches; this means that log files may be sent in
397+
// shorter intervals than this.
398+
type LogpushJobMaxUploadIntervalSeconds float64
399+
400+
const (
401+
LogpushJobMaxUploadIntervalSeconds0 LogpushJobMaxUploadIntervalSeconds = 0
402+
)
403+
404+
func (r LogpushJobMaxUploadIntervalSeconds) IsKnown() bool {
405+
switch r {
406+
case LogpushJobMaxUploadIntervalSeconds0:
407+
return true
408+
}
409+
return false
410+
}
411+
412+
// The maximum number of log lines per batch. This setting must be between 1000 and
413+
// 1,000,000 lines, or `0` to disable it. Note that you cannot specify a minimum
414+
// number of log lines per batch; this means that log files may contain many fewer
415+
// lines than this.
416+
type LogpushJobMaxUploadRecords float64
417+
418+
const (
419+
LogpushJobMaxUploadRecords0 LogpushJobMaxUploadRecords = 0
420+
)
421+
422+
func (r LogpushJobMaxUploadRecords) IsKnown() bool {
423+
switch r {
424+
case LogpushJobMaxUploadRecords0:
425+
return true
426+
}
427+
return false
428+
}
429+
378430
// The structured replacement for `logpull_options`. When including this field, the
379431
// `logpull_option` field will be ignored.
380432
type OutputOptions struct {
@@ -577,20 +629,18 @@ type JobNewParams struct {
577629
// The maximum uncompressed file size of a batch of logs. This setting value must
578630
// be between `5 MB` and `1 GB`, or `0` to disable it. Note that you cannot set a
579631
// minimum file size; this means that log files may be much smaller than this batch
580-
// size. This parameter is not available for jobs with `edge` as its kind.
581-
MaxUploadBytes param.Field[int64] `json:"max_upload_bytes"`
632+
// size.
633+
MaxUploadBytes param.Field[JobNewParamsMaxUploadBytes] `json:"max_upload_bytes"`
582634
// The maximum interval in seconds for log batches. This setting must be between 30
583635
// and 300 seconds (5 minutes), or `0` to disable it. Note that you cannot specify
584636
// a minimum interval for log batches; this means that log files may be sent in
585-
// shorter intervals than this. This parameter is only used for jobs with `edge` as
586-
// its kind.
587-
MaxUploadIntervalSeconds param.Field[int64] `json:"max_upload_interval_seconds"`
637+
// shorter intervals than this.
638+
MaxUploadIntervalSeconds param.Field[JobNewParamsMaxUploadIntervalSeconds] `json:"max_upload_interval_seconds"`
588639
// The maximum number of log lines per batch. This setting must be between 1000 and
589640
// 1,000,000 lines, or `0` to disable it. Note that you cannot specify a minimum
590641
// number of log lines per batch; this means that log files may contain many fewer
591-
// lines than this. This parameter is not available for jobs with `edge` as its
592-
// kind.
593-
MaxUploadRecords param.Field[int64] `json:"max_upload_records"`
642+
// lines than this.
643+
MaxUploadRecords param.Field[JobNewParamsMaxUploadRecords] `json:"max_upload_records"`
594644
// Optional human readable job name. Not unique. Cloudflare suggests that you set
595645
// this to a meaningful string, like the domain name, to make it easier to identify
596646
// your job.
@@ -681,6 +731,60 @@ func (r JobNewParamsKind) IsKnown() bool {
681731
return false
682732
}
683733

734+
// The maximum uncompressed file size of a batch of logs. This setting value must
735+
// be between `5 MB` and `1 GB`, or `0` to disable it. Note that you cannot set a
736+
// minimum file size; this means that log files may be much smaller than this batch
737+
// size.
738+
type JobNewParamsMaxUploadBytes float64
739+
740+
const (
741+
JobNewParamsMaxUploadBytes0 JobNewParamsMaxUploadBytes = 0
742+
)
743+
744+
func (r JobNewParamsMaxUploadBytes) IsKnown() bool {
745+
switch r {
746+
case JobNewParamsMaxUploadBytes0:
747+
return true
748+
}
749+
return false
750+
}
751+
752+
// The maximum interval in seconds for log batches. This setting must be between 30
753+
// and 300 seconds (5 minutes), or `0` to disable it. Note that you cannot specify
754+
// a minimum interval for log batches; this means that log files may be sent in
755+
// shorter intervals than this.
756+
type JobNewParamsMaxUploadIntervalSeconds float64
757+
758+
const (
759+
JobNewParamsMaxUploadIntervalSeconds0 JobNewParamsMaxUploadIntervalSeconds = 0
760+
)
761+
762+
func (r JobNewParamsMaxUploadIntervalSeconds) IsKnown() bool {
763+
switch r {
764+
case JobNewParamsMaxUploadIntervalSeconds0:
765+
return true
766+
}
767+
return false
768+
}
769+
770+
// The maximum number of log lines per batch. This setting must be between 1000 and
771+
// 1,000,000 lines, or `0` to disable it. Note that you cannot specify a minimum
772+
// number of log lines per batch; this means that log files may contain many fewer
773+
// lines than this.
774+
type JobNewParamsMaxUploadRecords float64
775+
776+
const (
777+
JobNewParamsMaxUploadRecords0 JobNewParamsMaxUploadRecords = 0
778+
)
779+
780+
func (r JobNewParamsMaxUploadRecords) IsKnown() bool {
781+
switch r {
782+
case JobNewParamsMaxUploadRecords0:
783+
return true
784+
}
785+
return false
786+
}
787+
684788
type JobNewResponseEnvelope struct {
685789
Errors []JobNewResponseEnvelopeErrors `json:"errors,required"`
686790
Messages []JobNewResponseEnvelopeMessages `json:"messages,required"`
@@ -852,20 +956,18 @@ type JobUpdateParams struct {
852956
// The maximum uncompressed file size of a batch of logs. This setting value must
853957
// be between `5 MB` and `1 GB`, or `0` to disable it. Note that you cannot set a
854958
// minimum file size; this means that log files may be much smaller than this batch
855-
// size. This parameter is not available for jobs with `edge` as its kind.
856-
MaxUploadBytes param.Field[int64] `json:"max_upload_bytes"`
959+
// size.
960+
MaxUploadBytes param.Field[JobUpdateParamsMaxUploadBytes] `json:"max_upload_bytes"`
857961
// The maximum interval in seconds for log batches. This setting must be between 30
858962
// and 300 seconds (5 minutes), or `0` to disable it. Note that you cannot specify
859963
// a minimum interval for log batches; this means that log files may be sent in
860-
// shorter intervals than this. This parameter is only used for jobs with `edge` as
861-
// its kind.
862-
MaxUploadIntervalSeconds param.Field[int64] `json:"max_upload_interval_seconds"`
964+
// shorter intervals than this.
965+
MaxUploadIntervalSeconds param.Field[JobUpdateParamsMaxUploadIntervalSeconds] `json:"max_upload_interval_seconds"`
863966
// The maximum number of log lines per batch. This setting must be between 1000 and
864967
// 1,000,000 lines, or `0` to disable it. Note that you cannot specify a minimum
865968
// number of log lines per batch; this means that log files may contain many fewer
866-
// lines than this. This parameter is not available for jobs with `edge` as its
867-
// kind.
868-
MaxUploadRecords param.Field[int64] `json:"max_upload_records"`
969+
// lines than this.
970+
MaxUploadRecords param.Field[JobUpdateParamsMaxUploadRecords] `json:"max_upload_records"`
869971
// Optional human readable job name. Not unique. Cloudflare suggests that you set
870972
// this to a meaningful string, like the domain name, to make it easier to identify
871973
// your job.
@@ -917,6 +1019,60 @@ func (r JobUpdateParamsKind) IsKnown() bool {
9171019
return false
9181020
}
9191021

1022+
// The maximum uncompressed file size of a batch of logs. This setting value must
1023+
// be between `5 MB` and `1 GB`, or `0` to disable it. Note that you cannot set a
1024+
// minimum file size; this means that log files may be much smaller than this batch
1025+
// size.
1026+
type JobUpdateParamsMaxUploadBytes float64
1027+
1028+
const (
1029+
JobUpdateParamsMaxUploadBytes0 JobUpdateParamsMaxUploadBytes = 0
1030+
)
1031+
1032+
func (r JobUpdateParamsMaxUploadBytes) IsKnown() bool {
1033+
switch r {
1034+
case JobUpdateParamsMaxUploadBytes0:
1035+
return true
1036+
}
1037+
return false
1038+
}
1039+
1040+
// The maximum interval in seconds for log batches. This setting must be between 30
1041+
// and 300 seconds (5 minutes), or `0` to disable it. Note that you cannot specify
1042+
// a minimum interval for log batches; this means that log files may be sent in
1043+
// shorter intervals than this.
1044+
type JobUpdateParamsMaxUploadIntervalSeconds float64
1045+
1046+
const (
1047+
JobUpdateParamsMaxUploadIntervalSeconds0 JobUpdateParamsMaxUploadIntervalSeconds = 0
1048+
)
1049+
1050+
func (r JobUpdateParamsMaxUploadIntervalSeconds) IsKnown() bool {
1051+
switch r {
1052+
case JobUpdateParamsMaxUploadIntervalSeconds0:
1053+
return true
1054+
}
1055+
return false
1056+
}
1057+
1058+
// The maximum number of log lines per batch. This setting must be between 1000 and
1059+
// 1,000,000 lines, or `0` to disable it. Note that you cannot specify a minimum
1060+
// number of log lines per batch; this means that log files may contain many fewer
1061+
// lines than this.
1062+
type JobUpdateParamsMaxUploadRecords float64
1063+
1064+
const (
1065+
JobUpdateParamsMaxUploadRecords0 JobUpdateParamsMaxUploadRecords = 0
1066+
)
1067+
1068+
func (r JobUpdateParamsMaxUploadRecords) IsKnown() bool {
1069+
switch r {
1070+
case JobUpdateParamsMaxUploadRecords0:
1071+
return true
1072+
}
1073+
return false
1074+
}
1075+
9201076
type JobUpdateResponseEnvelope struct {
9211077
Errors []JobUpdateResponseEnvelopeErrors `json:"errors,required"`
9221078
Messages []JobUpdateResponseEnvelopeMessages `json:"messages,required"`

logpush/job_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ func TestJobNewWithOptionalParams(t *testing.T) {
3737
Frequency: cloudflare.F(logpush.JobNewParamsFrequencyHigh),
3838
Kind: cloudflare.F(logpush.JobNewParamsKindEmpty),
3939
LogpullOptions: cloudflare.F("fields=RayID,ClientIP,EdgeStartTimestamp&timestamps=rfc3339"),
40-
MaxUploadBytes: cloudflare.F(int64(5000000)),
41-
MaxUploadIntervalSeconds: cloudflare.F(int64(30)),
42-
MaxUploadRecords: cloudflare.F(int64(1000)),
40+
MaxUploadBytes: cloudflare.F(logpush.JobNewParamsMaxUploadBytes0),
41+
MaxUploadIntervalSeconds: cloudflare.F(logpush.JobNewParamsMaxUploadIntervalSeconds0),
42+
MaxUploadRecords: cloudflare.F(logpush.JobNewParamsMaxUploadRecords0),
4343
Name: cloudflare.F("example.com"),
4444
OutputOptions: cloudflare.F(logpush.OutputOptionsParam{
4545
BatchPrefix: cloudflare.F(""),
@@ -91,9 +91,9 @@ func TestJobUpdateWithOptionalParams(t *testing.T) {
9191
Frequency: cloudflare.F(logpush.JobUpdateParamsFrequencyHigh),
9292
Kind: cloudflare.F(logpush.JobUpdateParamsKindEmpty),
9393
LogpullOptions: cloudflare.F("fields=RayID,ClientIP,EdgeStartTimestamp&timestamps=rfc3339"),
94-
MaxUploadBytes: cloudflare.F(int64(5000000)),
95-
MaxUploadIntervalSeconds: cloudflare.F(int64(30)),
96-
MaxUploadRecords: cloudflare.F(int64(1000)),
94+
MaxUploadBytes: cloudflare.F(logpush.JobUpdateParamsMaxUploadBytes0),
95+
MaxUploadIntervalSeconds: cloudflare.F(logpush.JobUpdateParamsMaxUploadIntervalSeconds0),
96+
MaxUploadRecords: cloudflare.F(logpush.JobUpdateParamsMaxUploadRecords0),
9797
Name: cloudflare.F("example.com"),
9898
OutputOptions: cloudflare.F(logpush.OutputOptionsParam{
9999
BatchPrefix: cloudflare.F(""),

0 commit comments

Comments
 (0)