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 #1664

Merged
merged 1 commit into from
Apr 4, 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
316 changes: 158 additions & 158 deletions api.md

Large diffs are not rendered by default.

53 changes: 26 additions & 27 deletions zones/settingadvancedddos.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewSettingAdvancedDDoSService(opts ...option.RequestOption) (r *SettingAdva
// 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 *SettingAdvancedDDoSService) Get(ctx context.Context, query SettingAdvancedDDoSGetParams, opts ...option.RequestOption) (res *ZoneSettingAdvancedDDoS, err error) {
func (r *SettingAdvancedDDoSService) Get(ctx context.Context, query SettingAdvancedDDoSGetParams, opts ...option.RequestOption) (res *AdvancedDDoS, err error) {
opts = append(r.Options[:], opts...)
var env SettingAdvancedDDoSGetResponseEnvelope
path := fmt.Sprintf("zones/%s/settings/advanced_ddos", query.ZoneID)
Expand All @@ -51,22 +51,21 @@ func (r *SettingAdvancedDDoSService) Get(ctx context.Context, query SettingAdvan
// 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.
type ZoneSettingAdvancedDDoS struct {
type AdvancedDDoS struct {
// ID of the zone setting.
ID ZoneSettingAdvancedDDoSID `json:"id,required"`
ID AdvancedDDoSID `json:"id,required"`
// Current value of the zone setting.
Value ZoneSettingAdvancedDDoSValue `json:"value,required"`
Value AdvancedDDoSValue `json:"value,required"`
// Whether or not this setting can be modified for this zone (based on your
// Cloudflare plan level).
Editable ZoneSettingAdvancedDDoSEditable `json:"editable"`
Editable AdvancedDDoSEditable `json:"editable"`
// last time this setting was modified.
ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"`
JSON zoneSettingAdvancedDDoSJSON `json:"-"`
ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"`
JSON advancedDDoSJSON `json:"-"`
}

// zoneSettingAdvancedDDoSJSON contains the JSON metadata for the struct
// [ZoneSettingAdvancedDDoS]
type zoneSettingAdvancedDDoSJSON struct {
// advancedDDoSJSON contains the JSON metadata for the struct [AdvancedDDoS]
type advancedDDoSJSON struct {
ID apijson.Field
Value apijson.Field
Editable apijson.Field
Expand All @@ -75,57 +74,57 @@ type zoneSettingAdvancedDDoSJSON struct {
ExtraFields map[string]apijson.Field
}

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

func (r zoneSettingAdvancedDDoSJSON) RawJSON() string {
func (r advancedDDoSJSON) RawJSON() string {
return r.raw
}

// ID of the zone setting.
type ZoneSettingAdvancedDDoSID string
type AdvancedDDoSID string

const (
ZoneSettingAdvancedDDoSIDAdvancedDDoS ZoneSettingAdvancedDDoSID = "advanced_ddos"
AdvancedDDoSIDAdvancedDDoS AdvancedDDoSID = "advanced_ddos"
)

func (r ZoneSettingAdvancedDDoSID) IsKnown() bool {
func (r AdvancedDDoSID) IsKnown() bool {
switch r {
case ZoneSettingAdvancedDDoSIDAdvancedDDoS:
case AdvancedDDoSIDAdvancedDDoS:
return true
}
return false
}

// Current value of the zone setting.
type ZoneSettingAdvancedDDoSValue string
type AdvancedDDoSValue string

const (
ZoneSettingAdvancedDDoSValueOn ZoneSettingAdvancedDDoSValue = "on"
ZoneSettingAdvancedDDoSValueOff ZoneSettingAdvancedDDoSValue = "off"
AdvancedDDoSValueOn AdvancedDDoSValue = "on"
AdvancedDDoSValueOff AdvancedDDoSValue = "off"
)

func (r ZoneSettingAdvancedDDoSValue) IsKnown() bool {
func (r AdvancedDDoSValue) IsKnown() bool {
switch r {
case ZoneSettingAdvancedDDoSValueOn, ZoneSettingAdvancedDDoSValueOff:
case AdvancedDDoSValueOn, AdvancedDDoSValueOff:
return true
}
return false
}

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

const (
ZoneSettingAdvancedDDoSEditableTrue ZoneSettingAdvancedDDoSEditable = true
ZoneSettingAdvancedDDoSEditableFalse ZoneSettingAdvancedDDoSEditable = false
AdvancedDDoSEditableTrue AdvancedDDoSEditable = true
AdvancedDDoSEditableFalse AdvancedDDoSEditable = false
)

func (r ZoneSettingAdvancedDDoSEditable) IsKnown() bool {
func (r AdvancedDDoSEditable) IsKnown() bool {
switch r {
case ZoneSettingAdvancedDDoSEditableTrue, ZoneSettingAdvancedDDoSEditableFalse:
case AdvancedDDoSEditableTrue, AdvancedDDoSEditableFalse:
return true
}
return false
Expand All @@ -144,7 +143,7 @@ type SettingAdvancedDDoSGetResponseEnvelope struct {
// 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.
Result ZoneSettingAdvancedDDoS `json:"result"`
Result AdvancedDDoS `json:"result"`
JSON settingAdvancedDDoSGetResponseEnvelopeJSON `json:"-"`
}

Expand Down
57 changes: 28 additions & 29 deletions zones/settingalwaysonline.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func NewSettingAlwaysOnlineService(opts ...option.RequestOption) (r *SettingAlwa
// offline. Refer to
// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for
// more information.
func (r *SettingAlwaysOnlineService) Edit(ctx context.Context, params SettingAlwaysOnlineEditParams, opts ...option.RequestOption) (res *ZoneSettingAlwaysOnline, err error) {
func (r *SettingAlwaysOnlineService) Edit(ctx context.Context, params SettingAlwaysOnlineEditParams, opts ...option.RequestOption) (res *AlwaysOnline, err error) {
opts = append(r.Options[:], opts...)
var env SettingAlwaysOnlineEditResponseEnvelope
path := fmt.Sprintf("zones/%s/settings/always_online", params.ZoneID)
Expand All @@ -55,7 +55,7 @@ func (r *SettingAlwaysOnlineService) Edit(ctx context.Context, params SettingAlw
// offline. Refer to
// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for
// more information.
func (r *SettingAlwaysOnlineService) Get(ctx context.Context, query SettingAlwaysOnlineGetParams, opts ...option.RequestOption) (res *ZoneSettingAlwaysOnline, err error) {
func (r *SettingAlwaysOnlineService) Get(ctx context.Context, query SettingAlwaysOnlineGetParams, opts ...option.RequestOption) (res *AlwaysOnline, err error) {
opts = append(r.Options[:], opts...)
var env SettingAlwaysOnlineGetResponseEnvelope
path := fmt.Sprintf("zones/%s/settings/always_online", query.ZoneID)
Expand All @@ -72,22 +72,21 @@ func (r *SettingAlwaysOnlineService) Get(ctx context.Context, query SettingAlway
// offline. Refer to
// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for
// more information.
type ZoneSettingAlwaysOnline struct {
type AlwaysOnline struct {
// ID of the zone setting.
ID ZoneSettingAlwaysOnlineID `json:"id,required"`
ID AlwaysOnlineID `json:"id,required"`
// Current value of the zone setting.
Value ZoneSettingAlwaysOnlineValue `json:"value,required"`
Value AlwaysOnlineValue `json:"value,required"`
// Whether or not this setting can be modified for this zone (based on your
// Cloudflare plan level).
Editable ZoneSettingAlwaysOnlineEditable `json:"editable"`
Editable AlwaysOnlineEditable `json:"editable"`
// last time this setting was modified.
ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"`
JSON zoneSettingAlwaysOnlineJSON `json:"-"`
ModifiedOn time.Time `json:"modified_on,nullable" format:"date-time"`
JSON alwaysOnlineJSON `json:"-"`
}

// zoneSettingAlwaysOnlineJSON contains the JSON metadata for the struct
// [ZoneSettingAlwaysOnline]
type zoneSettingAlwaysOnlineJSON struct {
// alwaysOnlineJSON contains the JSON metadata for the struct [AlwaysOnline]
type alwaysOnlineJSON struct {
ID apijson.Field
Value apijson.Field
Editable apijson.Field
Expand All @@ -96,57 +95,57 @@ type zoneSettingAlwaysOnlineJSON struct {
ExtraFields map[string]apijson.Field
}

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

func (r zoneSettingAlwaysOnlineJSON) RawJSON() string {
func (r alwaysOnlineJSON) RawJSON() string {
return r.raw
}

// ID of the zone setting.
type ZoneSettingAlwaysOnlineID string
type AlwaysOnlineID string

const (
ZoneSettingAlwaysOnlineIDAlwaysOnline ZoneSettingAlwaysOnlineID = "always_online"
AlwaysOnlineIDAlwaysOnline AlwaysOnlineID = "always_online"
)

func (r ZoneSettingAlwaysOnlineID) IsKnown() bool {
func (r AlwaysOnlineID) IsKnown() bool {
switch r {
case ZoneSettingAlwaysOnlineIDAlwaysOnline:
case AlwaysOnlineIDAlwaysOnline:
return true
}
return false
}

// Current value of the zone setting.
type ZoneSettingAlwaysOnlineValue string
type AlwaysOnlineValue string

const (
ZoneSettingAlwaysOnlineValueOn ZoneSettingAlwaysOnlineValue = "on"
ZoneSettingAlwaysOnlineValueOff ZoneSettingAlwaysOnlineValue = "off"
AlwaysOnlineValueOn AlwaysOnlineValue = "on"
AlwaysOnlineValueOff AlwaysOnlineValue = "off"
)

func (r ZoneSettingAlwaysOnlineValue) IsKnown() bool {
func (r AlwaysOnlineValue) IsKnown() bool {
switch r {
case ZoneSettingAlwaysOnlineValueOn, ZoneSettingAlwaysOnlineValueOff:
case AlwaysOnlineValueOn, AlwaysOnlineValueOff:
return true
}
return false
}

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

const (
ZoneSettingAlwaysOnlineEditableTrue ZoneSettingAlwaysOnlineEditable = true
ZoneSettingAlwaysOnlineEditableFalse ZoneSettingAlwaysOnlineEditable = false
AlwaysOnlineEditableTrue AlwaysOnlineEditable = true
AlwaysOnlineEditableFalse AlwaysOnlineEditable = false
)

func (r ZoneSettingAlwaysOnlineEditable) IsKnown() bool {
func (r AlwaysOnlineEditable) IsKnown() bool {
switch r {
case ZoneSettingAlwaysOnlineEditableTrue, ZoneSettingAlwaysOnlineEditableFalse:
case AlwaysOnlineEditableTrue, AlwaysOnlineEditableFalse:
return true
}
return false
Expand Down Expand Up @@ -189,7 +188,7 @@ type SettingAlwaysOnlineEditResponseEnvelope struct {
// offline. Refer to
// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for
// more information.
Result ZoneSettingAlwaysOnline `json:"result"`
Result AlwaysOnline `json:"result"`
JSON settingAlwaysOnlineEditResponseEnvelopeJSON `json:"-"`
}

Expand Down Expand Up @@ -227,7 +226,7 @@ type SettingAlwaysOnlineGetResponseEnvelope struct {
// offline. Refer to
// [Always Online](https://developers.cloudflare.com/cache/about/always-online) for
// more information.
Result ZoneSettingAlwaysOnline `json:"result"`
Result AlwaysOnline `json:"result"`
JSON settingAlwaysOnlineGetResponseEnvelopeJSON `json:"-"`
}

Expand Down
Loading