Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#1717)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 9, 2024
1 parent ee49602 commit 43a6a9d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3698,7 +3698,7 @@ Methods:

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/request_tracers">request_tracers</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/request_tracers#RequestTracerTrace">RequestTracerTrace</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/request_tracers">request_tracers</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/request_tracers#Trace">Trace</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/request_tracers">request_tracers</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v2/request_tracers#TraceNewResponse">TraceNewResponse</a>

Methods:
Expand Down
50 changes: 48 additions & 2 deletions request_tracers/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,59 @@ func (r *TraceService) New(ctx context.Context, accountIdentifier string, body T
return
}

type RequestTracerTrace []RequestTracerTraceItem
// List of steps acting on request/response
type Trace struct {
// If step type is rule, then action performed by this rule
Action string `json:"action"`
// If step type is rule, then action parameters of this rule as JSON
ActionParameters interface{} `json:"action_parameters"`
// If step type is rule or ruleset, the description of this entity
Description string `json:"description"`
// If step type is rule, then expression used to match for this rule
Expression string `json:"expression"`
// If step type is ruleset, then kind of this ruleset
Kind string `json:"kind"`
// Whether tracing step affected tracing request/response
Matched bool `json:"matched"`
// If step type is ruleset, then name of this ruleset
Name string `json:"name"`
// Tracing step identifying name
StepName string `json:"step_name"`
Trace []Trace `json:"trace"`
// Tracing step type
Type string `json:"type"`
JSON traceJSON `json:"-"`
}

// traceJSON contains the JSON metadata for the struct [Trace]
type traceJSON struct {
Action apijson.Field
ActionParameters apijson.Field
Description apijson.Field
Expression apijson.Field
Kind apijson.Field
Matched apijson.Field
Name apijson.Field
StepName apijson.Field
Trace apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

func (r *Trace) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}

func (r traceJSON) RawJSON() string {
return r.raw
}

// Trace result with an origin status code
type TraceNewResponse struct {
// HTTP Status code of zone response
StatusCode int64 `json:"status_code"`
Trace RequestTracerTrace `json:"trace"`
Trace []Trace `json:"trace"`
JSON traceNewResponseJSON `json:"-"`
}

Expand Down

0 comments on commit 43a6a9d

Please sign in to comment.