Files
sdk/model_eval_dataset_req.go

244 lines
6.5 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 EvalDatasetReq type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &EvalDatasetReq{}
// EvalDatasetReq struct for EvalDatasetReq
type EvalDatasetReq struct {
// Description is free text about what this set measures; over 64 KiB is refused.
Description *string `json:"description,omitempty"`
// Metadata is a free-form object stored with the set and echoed back verbatim.
Metadata map[string]interface{} `json:"metadata,omitempty"`
// Name is the dataset's org-unique handle and the segment that will address it, so it must match ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$.
Name string `json:"name"`
AdditionalProperties map[string]interface{}
}
type _EvalDatasetReq EvalDatasetReq
// NewEvalDatasetReq instantiates a new EvalDatasetReq 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 NewEvalDatasetReq(name string) *EvalDatasetReq {
this := EvalDatasetReq{}
this.Name = name
return &this
}
// NewEvalDatasetReqWithDefaults instantiates a new EvalDatasetReq 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 NewEvalDatasetReqWithDefaults() *EvalDatasetReq {
this := EvalDatasetReq{}
return &this
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *EvalDatasetReq) GetDescription() string {
if o == nil || IsNil(o.Description) {
var ret string
return ret
}
return *o.Description
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *EvalDatasetReq) GetDescriptionOk() (*string, bool) {
if o == nil || IsNil(o.Description) {
return nil, false
}
return o.Description, true
}
// HasDescription returns a boolean if a field has been set.
func (o *EvalDatasetReq) HasDescription() bool {
if o != nil && !IsNil(o.Description) {
return true
}
return false
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *EvalDatasetReq) SetDescription(v string) {
o.Description = &v
}
// GetMetadata returns the Metadata field value if set, zero value otherwise.
func (o *EvalDatasetReq) GetMetadata() map[string]interface{} {
if o == nil || IsNil(o.Metadata) {
var ret map[string]interface{}
return ret
}
return o.Metadata
}
// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *EvalDatasetReq) GetMetadataOk() (map[string]interface{}, bool) {
if o == nil || IsNil(o.Metadata) {
return map[string]interface{}{}, false
}
return o.Metadata, true
}
// HasMetadata returns a boolean if a field has been set.
func (o *EvalDatasetReq) HasMetadata() bool {
if o != nil && !IsNil(o.Metadata) {
return true
}
return false
}
// SetMetadata gets a reference to the given map[string]interface{} and assigns it to the Metadata field.
func (o *EvalDatasetReq) SetMetadata(v map[string]interface{}) {
o.Metadata = v
}
// GetName returns the Name field value
func (o *EvalDatasetReq) GetName() string {
if o == nil {
var ret string
return ret
}
return o.Name
}
// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
func (o *EvalDatasetReq) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *EvalDatasetReq) SetName(v string) {
o.Name = v
}
func (o EvalDatasetReq) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o EvalDatasetReq) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Description) {
toSerialize["description"] = o.Description
}
if !IsNil(o.Metadata) {
toSerialize["metadata"] = o.Metadata
}
toSerialize["name"] = o.Name
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *EvalDatasetReq) 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{
"name",
}
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)
}
}
varEvalDatasetReq := _EvalDatasetReq{}
err = json.Unmarshal(data, &varEvalDatasetReq)
if err != nil {
return err
}
*o = EvalDatasetReq(varEvalDatasetReq)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "description")
delete(additionalProperties, "metadata")
delete(additionalProperties, "name")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableEvalDatasetReq struct {
value *EvalDatasetReq
isSet bool
}
func (v NullableEvalDatasetReq) Get() *EvalDatasetReq {
return v.value
}
func (v *NullableEvalDatasetReq) Set(val *EvalDatasetReq) {
v.value = val
v.isSet = true
}
func (v NullableEvalDatasetReq) IsSet() bool {
return v.isSet
}
func (v *NullableEvalDatasetReq) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableEvalDatasetReq(val *EvalDatasetReq) *NullableEvalDatasetReq {
return &NullableEvalDatasetReq{value: val, isSet: true}
}
func (v NullableEvalDatasetReq) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableEvalDatasetReq) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}