mirror of
https://github.com/hanzo-go/sdk.git
synced 2026-11-20 20:13:42 +00:00
307 lines
9.7 KiB
Go
307 lines
9.7 KiB
Go
/*
|
|
Hanzo Cloud API
|
|
|
|
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
|
|
|
|
API version: v1
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package hanzoai
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
// checks if the CloudflareWorkerScriptPut type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &CloudflareWorkerScriptPut{}
|
|
|
|
// CloudflareWorkerScriptPut struct for CloudflareWorkerScriptPut
|
|
type CloudflareWorkerScriptPut struct {
|
|
Bindings interface{} `json:"bindings,omitempty"`
|
|
// CompatibilityDate pins which Workers runtime behaviour the script runs under, as a plain calendar date (\"2024-01-01\"). Absent leaves the account's own default in force.
|
|
CompatibilityDate *string `json:"compatibilityDate,omitempty"`
|
|
// CompatibilityFlags turn individual runtime behaviours on or off around that date (\"nodejs_compat\"), in Cloudflare's own flag vocabulary. Absent means the date alone decides.
|
|
CompatibilityFlags []string `json:"compatibilityFlags,omitempty"`
|
|
// MainModule is the module file the runtime starts at. Absent means \"worker.js\".
|
|
MainModule *string `json:"mainModule,omitempty"`
|
|
// Script means two things on this route, and the document says so in both places it appears: the PATH segment names the Worker to publish, and the BODY field carries that Worker's ES-module source — the code itself, never a name or a URL. A blank or absent source is refused; there is no empty Worker.
|
|
Script *string `json:"script,omitempty"`
|
|
AdditionalProperties map[string]interface{}
|
|
}
|
|
|
|
type _CloudflareWorkerScriptPut CloudflareWorkerScriptPut
|
|
|
|
// NewCloudflareWorkerScriptPut instantiates a new CloudflareWorkerScriptPut object
|
|
// This constructor will assign default values to properties that have it defined,
|
|
// and makes sure properties required by API are set, but the set of arguments
|
|
// will change when the set of required properties is changed
|
|
func NewCloudflareWorkerScriptPut() *CloudflareWorkerScriptPut {
|
|
this := CloudflareWorkerScriptPut{}
|
|
return &this
|
|
}
|
|
|
|
// NewCloudflareWorkerScriptPutWithDefaults instantiates a new CloudflareWorkerScriptPut object
|
|
// This constructor will only assign default values to properties that have it defined,
|
|
// but it doesn't guarantee that properties required by API are set
|
|
func NewCloudflareWorkerScriptPutWithDefaults() *CloudflareWorkerScriptPut {
|
|
this := CloudflareWorkerScriptPut{}
|
|
return &this
|
|
}
|
|
|
|
// GetBindings returns the Bindings field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *CloudflareWorkerScriptPut) GetBindings() interface{} {
|
|
if o == nil {
|
|
var ret interface{}
|
|
return ret
|
|
}
|
|
return o.Bindings
|
|
}
|
|
|
|
// GetBindingsOk returns a tuple with the Bindings field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *CloudflareWorkerScriptPut) GetBindingsOk() (*interface{}, bool) {
|
|
if o == nil || IsNil(o.Bindings) {
|
|
return nil, false
|
|
}
|
|
return &o.Bindings, true
|
|
}
|
|
|
|
// HasBindings returns a boolean if a field has been set.
|
|
func (o *CloudflareWorkerScriptPut) HasBindings() bool {
|
|
if o != nil && !IsNil(o.Bindings) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetBindings gets a reference to the given interface{} and assigns it to the Bindings field.
|
|
func (o *CloudflareWorkerScriptPut) SetBindings(v interface{}) {
|
|
o.Bindings = v
|
|
}
|
|
|
|
// GetCompatibilityDate returns the CompatibilityDate field value if set, zero value otherwise.
|
|
func (o *CloudflareWorkerScriptPut) GetCompatibilityDate() string {
|
|
if o == nil || IsNil(o.CompatibilityDate) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.CompatibilityDate
|
|
}
|
|
|
|
// GetCompatibilityDateOk returns a tuple with the CompatibilityDate field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *CloudflareWorkerScriptPut) GetCompatibilityDateOk() (*string, bool) {
|
|
if o == nil || IsNil(o.CompatibilityDate) {
|
|
return nil, false
|
|
}
|
|
return o.CompatibilityDate, true
|
|
}
|
|
|
|
// HasCompatibilityDate returns a boolean if a field has been set.
|
|
func (o *CloudflareWorkerScriptPut) HasCompatibilityDate() bool {
|
|
if o != nil && !IsNil(o.CompatibilityDate) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCompatibilityDate gets a reference to the given string and assigns it to the CompatibilityDate field.
|
|
func (o *CloudflareWorkerScriptPut) SetCompatibilityDate(v string) {
|
|
o.CompatibilityDate = &v
|
|
}
|
|
|
|
// GetCompatibilityFlags returns the CompatibilityFlags field value if set, zero value otherwise.
|
|
func (o *CloudflareWorkerScriptPut) GetCompatibilityFlags() []string {
|
|
if o == nil || IsNil(o.CompatibilityFlags) {
|
|
var ret []string
|
|
return ret
|
|
}
|
|
return o.CompatibilityFlags
|
|
}
|
|
|
|
// GetCompatibilityFlagsOk returns a tuple with the CompatibilityFlags field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *CloudflareWorkerScriptPut) GetCompatibilityFlagsOk() ([]string, bool) {
|
|
if o == nil || IsNil(o.CompatibilityFlags) {
|
|
return nil, false
|
|
}
|
|
return o.CompatibilityFlags, true
|
|
}
|
|
|
|
// HasCompatibilityFlags returns a boolean if a field has been set.
|
|
func (o *CloudflareWorkerScriptPut) HasCompatibilityFlags() bool {
|
|
if o != nil && !IsNil(o.CompatibilityFlags) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetCompatibilityFlags gets a reference to the given []string and assigns it to the CompatibilityFlags field.
|
|
func (o *CloudflareWorkerScriptPut) SetCompatibilityFlags(v []string) {
|
|
o.CompatibilityFlags = v
|
|
}
|
|
|
|
// GetMainModule returns the MainModule field value if set, zero value otherwise.
|
|
func (o *CloudflareWorkerScriptPut) GetMainModule() string {
|
|
if o == nil || IsNil(o.MainModule) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.MainModule
|
|
}
|
|
|
|
// GetMainModuleOk returns a tuple with the MainModule field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *CloudflareWorkerScriptPut) GetMainModuleOk() (*string, bool) {
|
|
if o == nil || IsNil(o.MainModule) {
|
|
return nil, false
|
|
}
|
|
return o.MainModule, true
|
|
}
|
|
|
|
// HasMainModule returns a boolean if a field has been set.
|
|
func (o *CloudflareWorkerScriptPut) HasMainModule() bool {
|
|
if o != nil && !IsNil(o.MainModule) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetMainModule gets a reference to the given string and assigns it to the MainModule field.
|
|
func (o *CloudflareWorkerScriptPut) SetMainModule(v string) {
|
|
o.MainModule = &v
|
|
}
|
|
|
|
// GetScript returns the Script field value if set, zero value otherwise.
|
|
func (o *CloudflareWorkerScriptPut) GetScript() string {
|
|
if o == nil || IsNil(o.Script) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Script
|
|
}
|
|
|
|
// GetScriptOk returns a tuple with the Script field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *CloudflareWorkerScriptPut) GetScriptOk() (*string, bool) {
|
|
if o == nil || IsNil(o.Script) {
|
|
return nil, false
|
|
}
|
|
return o.Script, true
|
|
}
|
|
|
|
// HasScript returns a boolean if a field has been set.
|
|
func (o *CloudflareWorkerScriptPut) HasScript() bool {
|
|
if o != nil && !IsNil(o.Script) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetScript gets a reference to the given string and assigns it to the Script field.
|
|
func (o *CloudflareWorkerScriptPut) SetScript(v string) {
|
|
o.Script = &v
|
|
}
|
|
|
|
func (o CloudflareWorkerScriptPut) MarshalJSON() ([]byte, error) {
|
|
toSerialize, err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o CloudflareWorkerScriptPut) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if o.Bindings != nil {
|
|
toSerialize["bindings"] = o.Bindings
|
|
}
|
|
if !IsNil(o.CompatibilityDate) {
|
|
toSerialize["compatibilityDate"] = o.CompatibilityDate
|
|
}
|
|
if !IsNil(o.CompatibilityFlags) {
|
|
toSerialize["compatibilityFlags"] = o.CompatibilityFlags
|
|
}
|
|
if !IsNil(o.MainModule) {
|
|
toSerialize["mainModule"] = o.MainModule
|
|
}
|
|
if !IsNil(o.Script) {
|
|
toSerialize["script"] = o.Script
|
|
}
|
|
|
|
for key, value := range o.AdditionalProperties {
|
|
toSerialize[key] = value
|
|
}
|
|
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *CloudflareWorkerScriptPut) UnmarshalJSON(data []byte) (err error) {
|
|
varCloudflareWorkerScriptPut := _CloudflareWorkerScriptPut{}
|
|
|
|
err = json.Unmarshal(data, &varCloudflareWorkerScriptPut)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = CloudflareWorkerScriptPut(varCloudflareWorkerScriptPut)
|
|
|
|
additionalProperties := make(map[string]interface{})
|
|
|
|
if err = json.Unmarshal(data, &additionalProperties); err == nil {
|
|
delete(additionalProperties, "bindings")
|
|
delete(additionalProperties, "compatibilityDate")
|
|
delete(additionalProperties, "compatibilityFlags")
|
|
delete(additionalProperties, "mainModule")
|
|
delete(additionalProperties, "script")
|
|
o.AdditionalProperties = additionalProperties
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableCloudflareWorkerScriptPut struct {
|
|
value *CloudflareWorkerScriptPut
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableCloudflareWorkerScriptPut) Get() *CloudflareWorkerScriptPut {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableCloudflareWorkerScriptPut) Set(val *CloudflareWorkerScriptPut) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableCloudflareWorkerScriptPut) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableCloudflareWorkerScriptPut) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableCloudflareWorkerScriptPut(val *CloudflareWorkerScriptPut) *NullableCloudflareWorkerScriptPut {
|
|
return &NullableCloudflareWorkerScriptPut{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableCloudflareWorkerScriptPut) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableCloudflareWorkerScriptPut) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|