Skip to content

Commit

Permalink
feat: OpenAPI spec update
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Feb 5, 2024
1 parent f5d9f30 commit b84c56b
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 163 deletions.
6 changes: 3 additions & 3 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ Methods:
- <code title="get /zones/{zone_identifier}/settings">client.Zones.Settings.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go#ZoneSettingService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, zoneIdentifier <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go#ZoneSettingListResponse">ZoneSettingListResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="patch /zones/{zone_identifier}/settings">client.Zones.Settings.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go#ZoneSettingService.Edit">Edit</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, zoneIdentifier <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go#ZoneSettingEditParams">ZoneSettingEditParams</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go#ZoneSettingEditResponse">ZoneSettingEditResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

### AdvancedDdos
### AdvancedDDOS

Response Types:

- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go#ZoneSettingAdvancedDdoListResponse">ZoneSettingAdvancedDdoListResponse</a>
- <a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go#ZoneSettingAdvancedDDOSListResponse">ZoneSettingAdvancedDDOSListResponse</a>

Methods:

- <code title="get /zones/{zone_identifier}/settings/advanced_ddos">client.Zones.Settings.AdvancedDdos.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go#ZoneSettingAdvancedDdoService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, zoneIdentifier <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go#ZoneSettingAdvancedDdoListResponse">ZoneSettingAdvancedDdoListResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /zones/{zone_identifier}/settings/advanced_ddos">client.Zones.Settings.AdvancedDDOS.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go#ZoneSettingAdvancedDDOSService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, zoneIdentifier <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go">cloudflare</a>.<a href="https://pkg.go.dev/github.com/cloudflare/cloudflare-sdk-go#ZoneSettingAdvancedDDOSListResponse">ZoneSettingAdvancedDDOSListResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

### AlwaysOnlines

Expand Down
4 changes: 2 additions & 2 deletions zonesetting.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
// instead.
type ZoneSettingService struct {
Options []option.RequestOption
AdvancedDdos *ZoneSettingAdvancedDdoService
AdvancedDDOS *ZoneSettingAdvancedDDOSService
AlwaysOnlines *ZoneSettingAlwaysOnlineService
AlwaysUseHTTPs *ZoneSettingAlwaysUseHTTPService
AutomaticHTTPsRewrites *ZoneSettingAutomaticHTTPsRewriteService
Expand Down Expand Up @@ -78,7 +78,7 @@ type ZoneSettingService struct {
func NewZoneSettingService(opts ...option.RequestOption) (r *ZoneSettingService) {
r = &ZoneSettingService{}
r.Options = opts
r.AdvancedDdos = NewZoneSettingAdvancedDdoService(opts...)
r.AdvancedDDOS = NewZoneSettingAdvancedDDOSService(opts...)
r.AlwaysOnlines = NewZoneSettingAlwaysOnlineService(opts...)
r.AlwaysUseHTTPs = NewZoneSettingAlwaysUseHTTPService(opts...)
r.AutomaticHTTPsRewrites = NewZoneSettingAutomaticHTTPsRewriteService(opts...)
Expand Down
156 changes: 0 additions & 156 deletions zonesettingadvancedddo.go

This file was deleted.

156 changes: 156 additions & 0 deletions zonesettingadvancedddos.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
// File generated from our OpenAPI spec by Stainless.

package cloudflare

import (
"context"
"fmt"
"net/http"
"time"

"github.com/cloudflare/cloudflare-sdk-go/internal/apijson"
"github.com/cloudflare/cloudflare-sdk-go/internal/requestconfig"
"github.com/cloudflare/cloudflare-sdk-go/option"
)

// ZoneSettingAdvancedDDOSService contains methods and other services that help
// with interacting with the cloudflare API. Note, unlike clients, this service
// does not read variables from the environment automatically. You should not
// instantiate this service directly, and instead use the
// [NewZoneSettingAdvancedDDOSService] method instead.
type ZoneSettingAdvancedDDOSService struct {
Options []option.RequestOption
}

// NewZoneSettingAdvancedDDOSService generates a new service that applies the given
// options to each request. These options are applied after the parent client's
// options (if there is one), and before any request-specific options.
func NewZoneSettingAdvancedDDOSService(opts ...option.RequestOption) (r *ZoneSettingAdvancedDDOSService) {
r = &ZoneSettingAdvancedDDOSService{}
r.Options = opts
return
}

// Advanced protection from Distributed Denial of Service (DDoS) attacks on your
// website. This is an uneditable value that is 'on' in the case of Business and
// Enterprise zones.
func (r *ZoneSettingAdvancedDDOSService) List(ctx context.Context, zoneIdentifier string, opts ...option.RequestOption) (res *ZoneSettingAdvancedDDOSListResponse, err error) {
opts = append(r.Options[:], opts...)
path := fmt.Sprintf("zones/%s/settings/advanced_ddos", zoneIdentifier)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}

type ZoneSettingAdvancedDDOSListResponse struct {
Errors []ZoneSettingAdvancedDDOSListResponseError `json:"errors,required"`
Messages []ZoneSettingAdvancedDDOSListResponseMessage `json:"messages,required"`
// Whether the API call was successful
Success bool `json:"success,required"`
Result ZoneSettingAdvancedDDOSListResponseResult `json:"result"`
JSON zoneSettingAdvancedDDOSListResponseJSON `json:"-"`
}

// zoneSettingAdvancedDDOSListResponseJSON contains the JSON metadata for the
// struct [ZoneSettingAdvancedDDOSListResponse]
type zoneSettingAdvancedDDOSListResponseJSON struct {
Errors apijson.Field
Messages apijson.Field
Success apijson.Field
Result apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

type ZoneSettingAdvancedDDOSListResponseError struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON zoneSettingAdvancedDDOSListResponseErrorJSON `json:"-"`
}

// zoneSettingAdvancedDDOSListResponseErrorJSON contains the JSON metadata for the
// struct [ZoneSettingAdvancedDDOSListResponseError]
type zoneSettingAdvancedDDOSListResponseErrorJSON struct {
Code apijson.Field
Message apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

type ZoneSettingAdvancedDDOSListResponseMessage struct {
Code int64 `json:"code,required"`
Message string `json:"message,required"`
JSON zoneSettingAdvancedDDOSListResponseMessageJSON `json:"-"`
}

// zoneSettingAdvancedDDOSListResponseMessageJSON contains the JSON metadata for
// the struct [ZoneSettingAdvancedDDOSListResponseMessage]
type zoneSettingAdvancedDDOSListResponseMessageJSON struct {
Code apijson.Field
Message apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

type ZoneSettingAdvancedDDOSListResponseResult struct {
// ID of the zone setting.
ID ZoneSettingAdvancedDDOSListResponseResultID `json:"id,required"`
// Value of the zone setting. Notes: Defaults to on for Business+ plans
Value ZoneSettingAdvancedDDOSListResponseResultValue `json:"value,required"`
// Whether or not this setting can be modified for this zone (based on your
// Cloudflare plan level).
Editable ZoneSettingAdvancedDDOSListResponseResultEditable `json:"editable"`
// last time this setting was modified.
ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"`
JSON zoneSettingAdvancedDDOSListResponseResultJSON `json:"-"`
}

// zoneSettingAdvancedDDOSListResponseResultJSON contains the JSON metadata for the
// struct [ZoneSettingAdvancedDDOSListResponseResult]
type zoneSettingAdvancedDDOSListResponseResultJSON struct {
ID apijson.Field
Value apijson.Field
Editable apijson.Field
ModifiedOn apijson.Field
raw string
ExtraFields map[string]apijson.Field
}

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

// ID of the zone setting.
type ZoneSettingAdvancedDDOSListResponseResultID string

const (
ZoneSettingAdvancedDDOSListResponseResultIDAdvancedDDOS ZoneSettingAdvancedDDOSListResponseResultID = "advanced_ddos"
)

// Value of the zone setting. Notes: Defaults to on for Business+ plans
type ZoneSettingAdvancedDDOSListResponseResultValue string

const (
ZoneSettingAdvancedDDOSListResponseResultValueOn ZoneSettingAdvancedDDOSListResponseResultValue = "on"
ZoneSettingAdvancedDDOSListResponseResultValueOff ZoneSettingAdvancedDDOSListResponseResultValue = "off"
)

// Whether or not this setting can be modified for this zone (based on your
// Cloudflare plan level).
type ZoneSettingAdvancedDDOSListResponseResultEditable bool

const (
ZoneSettingAdvancedDDOSListResponseResultEditableTrue ZoneSettingAdvancedDDOSListResponseResultEditable = true
ZoneSettingAdvancedDDOSListResponseResultEditableFalse ZoneSettingAdvancedDDOSListResponseResultEditable = false
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/cloudflare/cloudflare-sdk-go/option"
)

func TestZoneSettingAdvancedDdoList(t *testing.T) {
func TestZoneSettingAdvancedDDOSList(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
Expand All @@ -27,7 +27,7 @@ func TestZoneSettingAdvancedDdoList(t *testing.T) {
option.WithEmail("dev@cloudflare.com"),
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
_, err := client.Zones.Settings.AdvancedDdos.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353")
_, err := client.Zones.Settings.AdvancedDDOS.List(context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353")
if err != nil {
var apierr *cloudflare.Error
if errors.As(err, &apierr) {
Expand Down

0 comments on commit b84c56b

Please sign in to comment.