Files
sdk/model_domain_renew_req.go

206 lines
5.1 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"
"fmt"
)
// checks if the DomainRenewReq type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &DomainRenewReq{}
// DomainRenewReq struct for DomainRenewReq
type DomainRenewReq struct {
// Domain is the name to extend. It is required, and the caller's org must hold it.
Domain string `json:"domain"`
// Years is how much longer to hold it, defaulting to 1.
Years *int64 `json:"years,omitempty"`
AdditionalProperties map[string]interface{}
}
type _DomainRenewReq DomainRenewReq
// NewDomainRenewReq instantiates a new DomainRenewReq 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 NewDomainRenewReq(domain string) *DomainRenewReq {
this := DomainRenewReq{}
this.Domain = domain
return &this
}
// NewDomainRenewReqWithDefaults instantiates a new DomainRenewReq 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 NewDomainRenewReqWithDefaults() *DomainRenewReq {
this := DomainRenewReq{}
return &this
}
// GetDomain returns the Domain field value
func (o *DomainRenewReq) GetDomain() string {
if o == nil {
var ret string
return ret
}
return o.Domain
}
// GetDomainOk returns a tuple with the Domain field value
// and a boolean to check if the value has been set.
func (o *DomainRenewReq) GetDomainOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Domain, true
}
// SetDomain sets field value
func (o *DomainRenewReq) SetDomain(v string) {
o.Domain = v
}
// GetYears returns the Years field value if set, zero value otherwise.
func (o *DomainRenewReq) GetYears() int64 {
if o == nil || IsNil(o.Years) {
var ret int64
return ret
}
return *o.Years
}
// GetYearsOk returns a tuple with the Years field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DomainRenewReq) GetYearsOk() (*int64, bool) {
if o == nil || IsNil(o.Years) {
return nil, false
}
return o.Years, true
}
// HasYears returns a boolean if a field has been set.
func (o *DomainRenewReq) HasYears() bool {
if o != nil && !IsNil(o.Years) {
return true
}
return false
}
// SetYears gets a reference to the given int64 and assigns it to the Years field.
func (o *DomainRenewReq) SetYears(v int64) {
o.Years = &v
}
func (o DomainRenewReq) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o DomainRenewReq) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["domain"] = o.Domain
if !IsNil(o.Years) {
toSerialize["years"] = o.Years
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *DomainRenewReq) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"domain",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err
}
for _, requiredProperty := range requiredProperties {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varDomainRenewReq := _DomainRenewReq{}
err = json.Unmarshal(data, &varDomainRenewReq)
if err != nil {
return err
}
*o = DomainRenewReq(varDomainRenewReq)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "domain")
delete(additionalProperties, "years")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableDomainRenewReq struct {
value *DomainRenewReq
isSet bool
}
func (v NullableDomainRenewReq) Get() *DomainRenewReq {
return v.value
}
func (v *NullableDomainRenewReq) Set(val *DomainRenewReq) {
v.value = val
v.isSet = true
}
func (v NullableDomainRenewReq) IsSet() bool {
return v.isSet
}
func (v *NullableDomainRenewReq) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableDomainRenewReq(val *DomainRenewReq) *NullableDomainRenewReq {
return &NullableDomainRenewReq{value: val, isSet: true}
}
func (v NullableDomainRenewReq) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableDomainRenewReq) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}