bunnyshell.com/sdk@v0.16.0/model_resource_list_item.go (about)

     1  /*
     2  API Bunnyshell Environments
     3  
     4  Interact with Bunnyshell Platform
     5  
     6  API version: 1.1.0
     7  Contact: osi+support@bunnyshell.com
     8  */
     9  
    10  // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
    11  
    12  package sdk
    13  
    14  import (
    15  	"encoding/json"
    16  )
    17  
    18  // checks if the ResourceListItem type satisfies the MappedNullable interface at compile time
    19  var _ MappedNullable = &ResourceListItem{}
    20  
    21  // ResourceListItem struct for ResourceListItem
    22  type ResourceListItem struct {
    23  	// The CPU resources for the container.
    24  	Cpu NullableString `json:"cpu,omitempty"`
    25  	// The Memory resources for the container.
    26  	Memory NullableString `json:"memory,omitempty"`
    27  }
    28  
    29  // NewResourceListItem instantiates a new ResourceListItem object
    30  // This constructor will assign default values to properties that have it defined,
    31  // and makes sure properties required by API are set, but the set of arguments
    32  // will change when the set of required properties is changed
    33  func NewResourceListItem() *ResourceListItem {
    34  	this := ResourceListItem{}
    35  	return &this
    36  }
    37  
    38  // NewResourceListItemWithDefaults instantiates a new ResourceListItem object
    39  // This constructor will only assign default values to properties that have it defined,
    40  // but it doesn't guarantee that properties required by API are set
    41  func NewResourceListItemWithDefaults() *ResourceListItem {
    42  	this := ResourceListItem{}
    43  	return &this
    44  }
    45  
    46  // GetCpu returns the Cpu field value if set, zero value otherwise (both if not set or set to explicit null).
    47  func (o *ResourceListItem) GetCpu() string {
    48  	if o == nil || IsNil(o.Cpu.Get()) {
    49  		var ret string
    50  		return ret
    51  	}
    52  	return *o.Cpu.Get()
    53  }
    54  
    55  // GetCpuOk returns a tuple with the Cpu field value if set, nil otherwise
    56  // and a boolean to check if the value has been set.
    57  // NOTE: If the value is an explicit nil, `nil, true` will be returned
    58  func (o *ResourceListItem) GetCpuOk() (*string, bool) {
    59  	if o == nil {
    60  		return nil, false
    61  	}
    62  	return o.Cpu.Get(), o.Cpu.IsSet()
    63  }
    64  
    65  // HasCpu returns a boolean if a field has been set.
    66  func (o *ResourceListItem) HasCpu() bool {
    67  	if o != nil && o.Cpu.IsSet() {
    68  		return true
    69  	}
    70  
    71  	return false
    72  }
    73  
    74  // SetCpu gets a reference to the given NullableString and assigns it to the Cpu field.
    75  func (o *ResourceListItem) SetCpu(v string) {
    76  	o.Cpu.Set(&v)
    77  }
    78  
    79  // SetCpuNil sets the value for Cpu to be an explicit nil
    80  func (o *ResourceListItem) SetCpuNil() {
    81  	o.Cpu.Set(nil)
    82  }
    83  
    84  // UnsetCpu ensures that no value is present for Cpu, not even an explicit nil
    85  func (o *ResourceListItem) UnsetCpu() {
    86  	o.Cpu.Unset()
    87  }
    88  
    89  // GetMemory returns the Memory field value if set, zero value otherwise (both if not set or set to explicit null).
    90  func (o *ResourceListItem) GetMemory() string {
    91  	if o == nil || IsNil(o.Memory.Get()) {
    92  		var ret string
    93  		return ret
    94  	}
    95  	return *o.Memory.Get()
    96  }
    97  
    98  // GetMemoryOk returns a tuple with the Memory field value if set, nil otherwise
    99  // and a boolean to check if the value has been set.
   100  // NOTE: If the value is an explicit nil, `nil, true` will be returned
   101  func (o *ResourceListItem) GetMemoryOk() (*string, bool) {
   102  	if o == nil {
   103  		return nil, false
   104  	}
   105  	return o.Memory.Get(), o.Memory.IsSet()
   106  }
   107  
   108  // HasMemory returns a boolean if a field has been set.
   109  func (o *ResourceListItem) HasMemory() bool {
   110  	if o != nil && o.Memory.IsSet() {
   111  		return true
   112  	}
   113  
   114  	return false
   115  }
   116  
   117  // SetMemory gets a reference to the given NullableString and assigns it to the Memory field.
   118  func (o *ResourceListItem) SetMemory(v string) {
   119  	o.Memory.Set(&v)
   120  }
   121  
   122  // SetMemoryNil sets the value for Memory to be an explicit nil
   123  func (o *ResourceListItem) SetMemoryNil() {
   124  	o.Memory.Set(nil)
   125  }
   126  
   127  // UnsetMemory ensures that no value is present for Memory, not even an explicit nil
   128  func (o *ResourceListItem) UnsetMemory() {
   129  	o.Memory.Unset()
   130  }
   131  
   132  func (o ResourceListItem) MarshalJSON() ([]byte, error) {
   133  	toSerialize, err := o.ToMap()
   134  	if err != nil {
   135  		return []byte{}, err
   136  	}
   137  	return json.Marshal(toSerialize)
   138  }
   139  
   140  func (o ResourceListItem) ToMap() (map[string]interface{}, error) {
   141  	toSerialize := map[string]interface{}{}
   142  	if o.Cpu.IsSet() {
   143  		toSerialize["cpu"] = o.Cpu.Get()
   144  	}
   145  	if o.Memory.IsSet() {
   146  		toSerialize["memory"] = o.Memory.Get()
   147  	}
   148  	return toSerialize, nil
   149  }
   150  
   151  type NullableResourceListItem struct {
   152  	value *ResourceListItem
   153  	isSet bool
   154  }
   155  
   156  func (v NullableResourceListItem) Get() *ResourceListItem {
   157  	return v.value
   158  }
   159  
   160  func (v *NullableResourceListItem) Set(val *ResourceListItem) {
   161  	v.value = val
   162  	v.isSet = true
   163  }
   164  
   165  func (v NullableResourceListItem) IsSet() bool {
   166  	return v.isSet
   167  }
   168  
   169  func (v *NullableResourceListItem) Unset() {
   170  	v.value = nil
   171  	v.isSet = false
   172  }
   173  
   174  func NewNullableResourceListItem(val *ResourceListItem) *NullableResourceListItem {
   175  	return &NullableResourceListItem{value: val, isSet: true}
   176  }
   177  
   178  func (v NullableResourceListItem) MarshalJSON() ([]byte, error) {
   179  	return json.Marshal(v.value)
   180  }
   181  
   182  func (v *NullableResourceListItem) UnmarshalJSON(src []byte) error {
   183  	v.isSet = true
   184  	return json.Unmarshal(src, &v.value)
   185  }