Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): update via SDK Studio #3645

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2497,7 +2497,6 @@ Methods:

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperation">DiscoveryOperation</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryGetResponse">DiscoveryGetResponse</a>

Methods:
Expand All @@ -2508,28 +2507,34 @@ Methods:

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperationListResponse">DiscoveryOperationListResponse</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperationBulkEditResponse">DiscoveryOperationBulkEditResponse</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperationEditResponse">DiscoveryOperationEditResponse</a>

Methods:

- <code title="get /zones/{zone_id}/api_gateway/discovery/operations">client.APIGateway.Discovery.Operations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperationService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperationListParams">DiscoveryOperationListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/packages/pagination#V4PagePaginationArray">V4PagePaginationArray</a>[<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperation">DiscoveryOperation</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /zones/{zone_id}/api_gateway/discovery/operations">client.APIGateway.Discovery.Operations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperationService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperationListParams">DiscoveryOperationListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/packages/pagination#V4PagePaginationArray">V4PagePaginationArray</a>[<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperationListResponse">DiscoveryOperationListResponse</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="patch /zones/{zone_id}/api_gateway/discovery/operations">client.APIGateway.Discovery.Operations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperationService.BulkEdit">BulkEdit</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperationBulkEditParams">DiscoveryOperationBulkEditParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperationBulkEditResponse">DiscoveryOperationBulkEditResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="patch /zones/{zone_id}/api_gateway/discovery/operations/{operation_id}">client.APIGateway.Discovery.Operations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperationService.Edit">Edit</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, operationID <a href="https://pkg.go.dev/builtin#string">string</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperationEditParams">DiscoveryOperationEditParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#DiscoveryOperationEditResponse">DiscoveryOperationEditResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

## Operations

Params Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#APIShieldOperationParam">APIShieldOperationParam</a>

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#APIShield">APIShield</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#APIShieldOperation">APIShieldOperation</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationNewResponse">OperationNewResponse</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationListResponse">OperationListResponse</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationDeleteResponse">OperationDeleteResponse</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationBulkDeleteResponse">OperationBulkDeleteResponse</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationGetResponse">OperationGetResponse</a>

Methods:

- <code title="post /zones/{zone_id}/api_gateway/operations">client.APIGateway.Operations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationService.New">New</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationNewParams">OperationNewParams</a>) ([]<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#APIShield">APIShield</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /zones/{zone_id}/api_gateway/operations">client.APIGateway.Operations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationService.New">New</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationNewParams">OperationNewParams</a>) ([]<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationNewResponse">OperationNewResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /zones/{zone_id}/api_gateway/operations">client.APIGateway.Operations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, params <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationListParams">OperationListParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/packages/pagination">pagination</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/packages/pagination#V4PagePaginationArray">V4PagePaginationArray</a>[<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationListResponse">OperationListResponse</a>], <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="delete /zones/{zone_id}/api_gateway/operations/{operation_id}">client.APIGateway.Operations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, operationID <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationDeleteParams">OperationDeleteParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationDeleteResponse">OperationDeleteResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="delete /zones/{zone_id}/api_gateway/operations">client.APIGateway.Operations.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationService.BulkDelete">BulkDelete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationBulkDeleteParams">OperationBulkDeleteParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway">api_gateway</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-go/v3/api_gateway#OperationBulkDeleteResponse">OperationBulkDeleteResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
Expand Down
158 changes: 0 additions & 158 deletions api_gateway/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,164 +54,6 @@ func (r *DiscoveryService) Get(ctx context.Context, query DiscoveryGetParams, op
return
}

type DiscoveryOperation struct {
// UUID
ID string `json:"id,required"`
// The endpoint which can contain path parameter templates in curly braces, each
// will be replaced from left to right with {varN}, starting with {var1}, during
// insertion. This will further be Cloudflare-normalized upon insertion. See:
// https://developers.cloudflare.com/rules/normalization/how-it-works/.
Endpoint string `json:"endpoint,required" format:"uri-template"`
// RFC3986-compliant host.
Host string `json:"host,required" format:"hostname"`
LastUpdated time.Time `json:"last_updated,required" format:"date-time"`
// The HTTP method used to access the endpoint.
Method DiscoveryOperationMethod `json:"method,required"`
// API discovery engine(s) that discovered this operation
Origin []DiscoveryOperationOrigin `json:"origin,required"`
// State of operation in API Discovery
//
// - `review` - Operation is not saved into API Shield Endpoint Management
// - `saved` - Operation is saved into API Shield Endpoint Management
// - `ignored` - Operation is marked as ignored
State DiscoveryOperationState `json:"state,required"`
Features DiscoveryOperationFeatures `json:"features"`
JSON discoveryOperationJSON `json:"-"`
}

// discoveryOperationJSON contains the JSON metadata for the struct
// [DiscoveryOperation]
type discoveryOperationJSON struct {
ID apijson.Field
Endpoint apijson.Field
Host apijson.Field
LastUpdated apijson.Field
Method apijson.Field
Origin apijson.Field
State apijson.Field
Features apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

// The HTTP method used to access the endpoint.
type DiscoveryOperationMethod string

const (
DiscoveryOperationMethodGet DiscoveryOperationMethod = "GET"
DiscoveryOperationMethodPost DiscoveryOperationMethod = "POST"
DiscoveryOperationMethodHead DiscoveryOperationMethod = "HEAD"
DiscoveryOperationMethodOptions DiscoveryOperationMethod = "OPTIONS"
DiscoveryOperationMethodPut DiscoveryOperationMethod = "PUT"
DiscoveryOperationMethodDelete DiscoveryOperationMethod = "DELETE"
DiscoveryOperationMethodConnect DiscoveryOperationMethod = "CONNECT"
DiscoveryOperationMethodPatch DiscoveryOperationMethod = "PATCH"
DiscoveryOperationMethodTrace DiscoveryOperationMethod = "TRACE"
)

func (r DiscoveryOperationMethod) IsKnown() bool {
switch r {
case DiscoveryOperationMethodGet, DiscoveryOperationMethodPost, DiscoveryOperationMethodHead, DiscoveryOperationMethodOptions, DiscoveryOperationMethodPut, DiscoveryOperationMethodDelete, DiscoveryOperationMethodConnect, DiscoveryOperationMethodPatch, DiscoveryOperationMethodTrace:
return true
}
return false
}

// - `ML` - Discovered operation was sourced using ML API Discovery \*
// `SessionIdentifier` - Discovered operation was sourced using Session
// Identifier API Discovery
type DiscoveryOperationOrigin string

const (
DiscoveryOperationOriginMl DiscoveryOperationOrigin = "ML"
DiscoveryOperationOriginSessionIdentifier DiscoveryOperationOrigin = "SessionIdentifier"
)

func (r DiscoveryOperationOrigin) IsKnown() bool {
switch r {
case DiscoveryOperationOriginMl, DiscoveryOperationOriginSessionIdentifier:
return true
}
return false
}

// State of operation in API Discovery
//
// - `review` - Operation is not saved into API Shield Endpoint Management
// - `saved` - Operation is saved into API Shield Endpoint Management
// - `ignored` - Operation is marked as ignored
type DiscoveryOperationState string

const (
DiscoveryOperationStateReview DiscoveryOperationState = "review"
DiscoveryOperationStateSaved DiscoveryOperationState = "saved"
DiscoveryOperationStateIgnored DiscoveryOperationState = "ignored"
)

func (r DiscoveryOperationState) IsKnown() bool {
switch r {
case DiscoveryOperationStateReview, DiscoveryOperationStateSaved, DiscoveryOperationStateIgnored:
return true
}
return false
}

type DiscoveryOperationFeatures struct {
TrafficStats DiscoveryOperationFeaturesTrafficStats `json:"traffic_stats"`
JSON discoveryOperationFeaturesJSON `json:"-"`
}

// discoveryOperationFeaturesJSON contains the JSON metadata for the struct
// [DiscoveryOperationFeatures]
type discoveryOperationFeaturesJSON struct {
TrafficStats apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

type DiscoveryOperationFeaturesTrafficStats struct {
LastUpdated time.Time `json:"last_updated,required" format:"date-time"`
// The period in seconds these statistics were computed over
PeriodSeconds int64 `json:"period_seconds,required"`
// The average number of requests seen during this period
Requests float64 `json:"requests,required"`
JSON discoveryOperationFeaturesTrafficStatsJSON `json:"-"`
}

// discoveryOperationFeaturesTrafficStatsJSON contains the JSON metadata for the
// struct [DiscoveryOperationFeaturesTrafficStats]
type discoveryOperationFeaturesTrafficStatsJSON struct {
LastUpdated apijson.Field
PeriodSeconds apijson.Field
Requests apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

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

type DiscoveryGetResponse struct {
Schemas []interface{} `json:"schemas,required"`
Timestamp time.Time `json:"timestamp,required" format:"date-time"`
Expand Down
Loading