Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#2285)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed May 31, 2024
1 parent c154540 commit 21a34b9
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1321
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a18a8d7f1f80a39beb83a6541eb29dea4a69df37444aeb85493c94256c11d3a6.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-7080386fb1d04dafc80523803a44e41bab56e2907c13694ced938d02a3abb9d5.yml
6 changes: 3 additions & 3 deletions zero_trust/dexcolo.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ type DEXColoListResponse = interface{}

type DEXColoListParams struct {
AccountID param.Field[string] `path:"account_id,required"`
// End time for connection period in RFC3339 (ISO 8601) format.
TimeEnd param.Field[string] `query:"timeEnd,required"`
// Start time for connection period in RFC3339 (ISO 8601) format.
TimeStart param.Field[string] `query:"timeStart,required"`
From param.Field[string] `query:"from,required"`
// End time for connection period in RFC3339 (ISO 8601) format.
To param.Field[string] `query:"to,required"`
// Type of usage that colos should be sorted by. If unspecified, returns all
// Cloudflare colos sorted alphabetically.
SortBy param.Field[DEXColoListParamsSortBy] `query:"sortBy"`
Expand Down
4 changes: 2 additions & 2 deletions zero_trust/dexcolo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func TestDEXColoListWithOptionalParams(t *testing.T) {
)
_, err := client.ZeroTrust.DEX.Colos.List(context.TODO(), zero_trust.DEXColoListParams{
AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"),
TimeEnd: cloudflare.F("2023-08-24T20:45:00Z"),
TimeStart: cloudflare.F("2023-08-20T20:45:00Z"),
From: cloudflare.F("2023-08-20T20:45:00Z"),
To: cloudflare.F("2023-08-24T20:45:00Z"),
SortBy: cloudflare.F(zero_trust.DEXColoListParamsSortByFleetStatusUsage),
})
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions zero_trust/dexfleetstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ func (r DEXFleetStatusLiveResponseEnvelopeSuccess) IsKnown() bool {
type DEXFleetStatusOverTimeParams struct {
AccountID param.Field[string] `path:"account_id,required"`
// Timestamp in ISO format
TimeEnd param.Field[string] `query:"time_end,required"`
From param.Field[string] `query:"from,required"`
// Timestamp in ISO format
TimeStart param.Field[string] `query:"time_start,required"`
To param.Field[string] `query:"to,required"`
// Cloudflare colo
Colo param.Field[string] `query:"colo"`
// Device-specific ID, given as UUID v4
Expand Down
4 changes: 2 additions & 2 deletions zero_trust/dexfleetstatus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func TestDEXFleetStatusOverTimeWithOptionalParams(t *testing.T) {
)
err := client.ZeroTrust.DEX.FleetStatus.OverTime(context.TODO(), zero_trust.DEXFleetStatusOverTimeParams{
AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"),
TimeEnd: cloudflare.F("2023-10-11T00:00:00Z"),
TimeStart: cloudflare.F("2023-10-11T00:00:00Z"),
From: cloudflare.F("2023-10-11T00:00:00Z"),
To: cloudflare.F("2023-10-11T00:00:00Z"),
Colo: cloudflare.F("SJC"),
DeviceID: cloudflare.F("cb49c27f-7f97-49c5-b6f3-f7c01ead0fd7"),
})
Expand Down
33 changes: 30 additions & 3 deletions zero_trust/dexfleetstatusdevice.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,20 @@ func (r dexFleetStatusDeviceListResponseJSON) RawJSON() string {

type DEXFleetStatusDeviceListParams struct {
AccountID param.Field[string] `path:"account_id,required"`
// Timestamp in ISO format
From param.Field[string] `query:"from,required"`
// Page number of paginated results
Page param.Field[float64] `query:"page,required"`
// Number of items per page
PerPage param.Field[float64] `query:"per_page,required"`
// Source:
//
// - `hourly` - device details aggregated hourly, up to 7 days prior
// - `last_seen` - device details, up to 24 hours prior
// - `raw` - device details, up to 7 days prior
Source param.Field[DEXFleetStatusDeviceListParamsSource] `query:"source,required"`
// Timestamp in ISO format
TimeEnd param.Field[string] `query:"time_end,required"`
// Timestamp in ISO format
TimeStart param.Field[string] `query:"time_start,required"`
To param.Field[string] `query:"to,required"`
// Cloudflare colo
Colo param.Field[string] `query:"colo"`
// Device-specific ID, given as UUID v4
Expand All @@ -133,6 +139,27 @@ func (r DEXFleetStatusDeviceListParams) URLQuery() (v url.Values) {
})
}

// Source:
//
// - `hourly` - device details aggregated hourly, up to 7 days prior
// - `last_seen` - device details, up to 24 hours prior
// - `raw` - device details, up to 7 days prior
type DEXFleetStatusDeviceListParamsSource string

const (
DEXFleetStatusDeviceListParamsSourceLastSeen DEXFleetStatusDeviceListParamsSource = "last_seen"
DEXFleetStatusDeviceListParamsSourceHourly DEXFleetStatusDeviceListParamsSource = "hourly"
DEXFleetStatusDeviceListParamsSourceRaw DEXFleetStatusDeviceListParamsSource = "raw"
)

func (r DEXFleetStatusDeviceListParamsSource) IsKnown() bool {
switch r {
case DEXFleetStatusDeviceListParamsSourceLastSeen, DEXFleetStatusDeviceListParamsSourceHourly, DEXFleetStatusDeviceListParamsSourceRaw:
return true
}
return false
}

// Dimension to sort results by
type DEXFleetStatusDeviceListParamsSortBy string

Expand Down
5 changes: 3 additions & 2 deletions zero_trust/dexfleetstatusdevice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ func TestDEXFleetStatusDeviceListWithOptionalParams(t *testing.T) {
)
_, err := client.ZeroTrust.DEX.FleetStatus.Devices.List(context.TODO(), zero_trust.DEXFleetStatusDeviceListParams{
AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"),
From: cloudflare.F("2023-10-11T00:00:00Z"),
Page: cloudflare.F(1.000000),
PerPage: cloudflare.F(10.000000),
TimeEnd: cloudflare.F("2023-10-11T00:00:00Z"),
TimeStart: cloudflare.F("2023-10-11T00:00:00Z"),
Source: cloudflare.F(zero_trust.DEXFleetStatusDeviceListParamsSourceLastSeen),
To: cloudflare.F("2023-10-11T00:00:00Z"),
Colo: cloudflare.F("SJC"),
DeviceID: cloudflare.F("cb49c27f-7f97-49c5-b6f3-f7c01ead0fd7"),
Mode: cloudflare.F("proxy"),
Expand Down
6 changes: 3 additions & 3 deletions zero_trust/dexhttptest.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,12 @@ func (r HTTPDetailsKind) IsKnown() bool {

type DEXHTTPTestGetParams struct {
AccountID param.Field[string] `path:"account_id,required"`
// Start time for aggregate metrics in ISO ms
From param.Field[string] `query:"from,required"`
// Time interval for aggregate time slots.
Interval param.Field[DexhttpTestGetParamsInterval] `query:"interval,required"`
// End time for aggregate metrics in ISO ms
TimeEnd param.Field[string] `query:"timeEnd,required"`
// Start time for aggregate metrics in ISO ms
TimeStart param.Field[string] `query:"timeStart,required"`
To param.Field[string] `query:"to,required"`
// Optionally filter result stats to a Cloudflare colo. Cannot be used in
// combination with deviceId param.
Colo param.Field[string] `query:"colo"`
Expand Down
4 changes: 2 additions & 2 deletions zero_trust/dexhttptest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ func TestDEXHTTPTestGetWithOptionalParams(t *testing.T) {
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
zero_trust.DEXHTTPTestGetParams{
AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"),
From: cloudflare.F("1689520412000"),
Interval: cloudflare.F(zero_trust.DexhttpTestGetParamsIntervalMinute),
TimeEnd: cloudflare.F("1689606812000"),
TimeStart: cloudflare.F("1689520412000"),
To: cloudflare.F("1689606812000"),
Colo: cloudflare.F("string"),
DeviceID: cloudflare.F([]string{"string", "string", "string"}),
},
Expand Down
6 changes: 3 additions & 3 deletions zero_trust/dexhttptestpercentile.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ func (r testStatOverTimeSlotJSON) RawJSON() string {

type DEXHTTPTestPercentileGetParams struct {
AccountID param.Field[string] `path:"account_id,required"`
// End time for aggregate metrics in ISO format
TimeEnd param.Field[string] `query:"timeEnd,required"`
// Start time for aggregate metrics in ISO format
TimeStart param.Field[string] `query:"timeStart,required"`
From param.Field[string] `query:"from,required"`
// End time for aggregate metrics in ISO format
To param.Field[string] `query:"to,required"`
// Optionally filter result stats to a Cloudflare colo. Cannot be used in
// combination with deviceId param.
Colo param.Field[string] `query:"colo"`
Expand Down
4 changes: 2 additions & 2 deletions zero_trust/dexhttptestpercentile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ func TestDEXHTTPTestPercentileGetWithOptionalParams(t *testing.T) {
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
zero_trust.DEXHTTPTestPercentileGetParams{
AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"),
TimeEnd: cloudflare.F("2023-09-20T17:00:00Z"),
TimeStart: cloudflare.F("2023-09-20T17:00:00Z"),
From: cloudflare.F("2023-09-20T17:00:00Z"),
To: cloudflare.F("2023-09-20T17:00:00Z"),
Colo: cloudflare.F("string"),
DeviceID: cloudflare.F([]string{"string", "string", "string"}),
},
Expand Down
18 changes: 9 additions & 9 deletions zero_trust/dextraceroutetest.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,12 +453,12 @@ func (r dexTracerouteTestPercentilesResponseJSON) RawJSON() string {

type DEXTracerouteTestGetParams struct {
AccountID param.Field[string] `path:"account_id,required"`
// Start time for aggregate metrics in ISO ms
From param.Field[string] `query:"from,required"`
// Time interval for aggregate time slots.
Interval param.Field[DEXTracerouteTestGetParamsInterval] `query:"interval,required"`
// End time for aggregate metrics in ISO ms
TimeEnd param.Field[string] `query:"timeEnd,required"`
// Start time for aggregate metrics in ISO ms
TimeStart param.Field[string] `query:"timeStart,required"`
To param.Field[string] `query:"to,required"`
// Optionally filter result stats to a Cloudflare colo. Cannot be used in
// combination with deviceId param.
Colo param.Field[string] `query:"colo"`
Expand Down Expand Up @@ -539,12 +539,12 @@ type DEXTracerouteTestNetworkPathParams struct {
AccountID param.Field[string] `path:"account_id,required"`
// Device to filter tracroute result runs to
DeviceID param.Field[string] `query:"deviceId,required"`
// Start time for aggregate metrics in ISO ms
From param.Field[string] `query:"from,required"`
// Time interval for aggregate time slots.
Interval param.Field[DEXTracerouteTestNetworkPathParamsInterval] `query:"interval,required"`
// End time for aggregate metrics in ISO ms
TimeEnd param.Field[string] `query:"timeEnd,required"`
// Start time for aggregate metrics in ISO ms
TimeStart param.Field[string] `query:"timeStart,required"`
To param.Field[string] `query:"to,required"`
}

// URLQuery serializes [DEXTracerouteTestNetworkPathParams]'s query parameters as
Expand Down Expand Up @@ -617,10 +617,10 @@ func (r DEXTracerouteTestNetworkPathResponseEnvelopeSuccess) IsKnown() bool {

type DEXTracerouteTestPercentilesParams struct {
AccountID param.Field[string] `path:"account_id,required"`
// End time for aggregate metrics in ISO format
TimeEnd param.Field[string] `query:"timeEnd,required"`
// Start time for aggregate metrics in ISO format
TimeStart param.Field[string] `query:"timeStart,required"`
From param.Field[string] `query:"from,required"`
// End time for aggregate metrics in ISO format
To param.Field[string] `query:"to,required"`
// Optionally filter result stats to a Cloudflare colo. Cannot be used in
// combination with deviceId param.
Colo param.Field[string] `query:"colo"`
Expand Down
12 changes: 6 additions & 6 deletions zero_trust/dextraceroutetest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ func TestDEXTracerouteTestGetWithOptionalParams(t *testing.T) {
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
zero_trust.DEXTracerouteTestGetParams{
AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"),
From: cloudflare.F("1689520412000"),
Interval: cloudflare.F(zero_trust.DEXTracerouteTestGetParamsIntervalMinute),
TimeEnd: cloudflare.F("1689606812000"),
TimeStart: cloudflare.F("1689520412000"),
To: cloudflare.F("1689606812000"),
Colo: cloudflare.F("string"),
DeviceID: cloudflare.F([]string{"string", "string", "string"}),
},
Expand Down Expand Up @@ -67,9 +67,9 @@ func TestDEXTracerouteTestNetworkPath(t *testing.T) {
zero_trust.DEXTracerouteTestNetworkPathParams{
AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"),
DeviceID: cloudflare.F("string"),
From: cloudflare.F("1689520412000"),
Interval: cloudflare.F(zero_trust.DEXTracerouteTestNetworkPathParamsIntervalMinute),
TimeEnd: cloudflare.F("1689606812000"),
TimeStart: cloudflare.F("1689520412000"),
To: cloudflare.F("1689606812000"),
},
)
if err != nil {
Expand Down Expand Up @@ -99,8 +99,8 @@ func TestDEXTracerouteTestPercentilesWithOptionalParams(t *testing.T) {
"f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
zero_trust.DEXTracerouteTestPercentilesParams{
AccountID: cloudflare.F("01a7362d577a6c3019a474fd6f485823"),
TimeEnd: cloudflare.F("2023-09-20T17:00:00Z"),
TimeStart: cloudflare.F("2023-09-20T17:00:00Z"),
From: cloudflare.F("2023-09-20T17:00:00Z"),
To: cloudflare.F("2023-09-20T17:00:00Z"),
Colo: cloudflare.F("string"),
DeviceID: cloudflare.F([]string{"string", "string", "string"}),
},
Expand Down
3 changes: 0 additions & 3 deletions zero_trust/dextraceroutetestresultnetworkpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ type DEXTracerouteTestResultNetworkPathGetResponse struct {
Hops []DEXTracerouteTestResultNetworkPathGetResponseHop `json:"hops,required"`
// API Resource UUID tag.
ResultID string `json:"resultId,required"`
// date time of this traceroute test
TimeStart string `json:"time_start,required"`
// name of the device associated with this network path response
DeviceName string `json:"deviceName"`
// API Resource UUID tag.
Expand All @@ -78,7 +76,6 @@ type DEXTracerouteTestResultNetworkPathGetResponse struct {
type dexTracerouteTestResultNetworkPathGetResponseJSON struct {
Hops apijson.Field
ResultID apijson.Field
TimeStart apijson.Field
DeviceName apijson.Field
TestID apijson.Field
TestName apijson.Field
Expand Down

0 comments on commit 21a34b9

Please sign in to comment.