bunnyshell.com/sdk@v0.16.0/model_component_resource_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 ComponentResourceItem type satisfies the MappedNullable interface at compile time 19 var _ MappedNullable = &ComponentResourceItem{} 20 21 // ComponentResourceItem A service component represents either an application or a group of applications as a single unit 22 type ComponentResourceItem struct { 23 // Kubernetes resource kind. 24 Kind *string `json:"kind,omitempty"` 25 // Kubernetes resource name. 26 Name *string `json:"name,omitempty"` 27 // Kubernetes resource namespace. 28 Namespace NullableString `json:"namespace,omitempty"` 29 } 30 31 // NewComponentResourceItem instantiates a new ComponentResourceItem object 32 // This constructor will assign default values to properties that have it defined, 33 // and makes sure properties required by API are set, but the set of arguments 34 // will change when the set of required properties is changed 35 func NewComponentResourceItem() *ComponentResourceItem { 36 this := ComponentResourceItem{} 37 return &this 38 } 39 40 // NewComponentResourceItemWithDefaults instantiates a new ComponentResourceItem object 41 // This constructor will only assign default values to properties that have it defined, 42 // but it doesn't guarantee that properties required by API are set 43 func NewComponentResourceItemWithDefaults() *ComponentResourceItem { 44 this := ComponentResourceItem{} 45 return &this 46 } 47 48 // GetKind returns the Kind field value if set, zero value otherwise. 49 func (o *ComponentResourceItem) GetKind() string { 50 if o == nil || IsNil(o.Kind) { 51 var ret string 52 return ret 53 } 54 return *o.Kind 55 } 56 57 // GetKindOk returns a tuple with the Kind field value if set, nil otherwise 58 // and a boolean to check if the value has been set. 59 func (o *ComponentResourceItem) GetKindOk() (*string, bool) { 60 if o == nil || IsNil(o.Kind) { 61 return nil, false 62 } 63 return o.Kind, true 64 } 65 66 // HasKind returns a boolean if a field has been set. 67 func (o *ComponentResourceItem) HasKind() bool { 68 if o != nil && !IsNil(o.Kind) { 69 return true 70 } 71 72 return false 73 } 74 75 // SetKind gets a reference to the given string and assigns it to the Kind field. 76 func (o *ComponentResourceItem) SetKind(v string) { 77 o.Kind = &v 78 } 79 80 // GetName returns the Name field value if set, zero value otherwise. 81 func (o *ComponentResourceItem) GetName() string { 82 if o == nil || IsNil(o.Name) { 83 var ret string 84 return ret 85 } 86 return *o.Name 87 } 88 89 // GetNameOk returns a tuple with the Name field value if set, nil otherwise 90 // and a boolean to check if the value has been set. 91 func (o *ComponentResourceItem) GetNameOk() (*string, bool) { 92 if o == nil || IsNil(o.Name) { 93 return nil, false 94 } 95 return o.Name, true 96 } 97 98 // HasName returns a boolean if a field has been set. 99 func (o *ComponentResourceItem) HasName() bool { 100 if o != nil && !IsNil(o.Name) { 101 return true 102 } 103 104 return false 105 } 106 107 // SetName gets a reference to the given string and assigns it to the Name field. 108 func (o *ComponentResourceItem) SetName(v string) { 109 o.Name = &v 110 } 111 112 // GetNamespace returns the Namespace field value if set, zero value otherwise (both if not set or set to explicit null). 113 func (o *ComponentResourceItem) GetNamespace() string { 114 if o == nil || IsNil(o.Namespace.Get()) { 115 var ret string 116 return ret 117 } 118 return *o.Namespace.Get() 119 } 120 121 // GetNamespaceOk returns a tuple with the Namespace field value if set, nil otherwise 122 // and a boolean to check if the value has been set. 123 // NOTE: If the value is an explicit nil, `nil, true` will be returned 124 func (o *ComponentResourceItem) GetNamespaceOk() (*string, bool) { 125 if o == nil { 126 return nil, false 127 } 128 return o.Namespace.Get(), o.Namespace.IsSet() 129 } 130 131 // HasNamespace returns a boolean if a field has been set. 132 func (o *ComponentResourceItem) HasNamespace() bool { 133 if o != nil && o.Namespace.IsSet() { 134 return true 135 } 136 137 return false 138 } 139 140 // SetNamespace gets a reference to the given NullableString and assigns it to the Namespace field. 141 func (o *ComponentResourceItem) SetNamespace(v string) { 142 o.Namespace.Set(&v) 143 } 144 145 // SetNamespaceNil sets the value for Namespace to be an explicit nil 146 func (o *ComponentResourceItem) SetNamespaceNil() { 147 o.Namespace.Set(nil) 148 } 149 150 // UnsetNamespace ensures that no value is present for Namespace, not even an explicit nil 151 func (o *ComponentResourceItem) UnsetNamespace() { 152 o.Namespace.Unset() 153 } 154 155 func (o ComponentResourceItem) MarshalJSON() ([]byte, error) { 156 toSerialize, err := o.ToMap() 157 if err != nil { 158 return []byte{}, err 159 } 160 return json.Marshal(toSerialize) 161 } 162 163 func (o ComponentResourceItem) ToMap() (map[string]interface{}, error) { 164 toSerialize := map[string]interface{}{} 165 if !IsNil(o.Kind) { 166 toSerialize["kind"] = o.Kind 167 } 168 if !IsNil(o.Name) { 169 toSerialize["name"] = o.Name 170 } 171 if o.Namespace.IsSet() { 172 toSerialize["namespace"] = o.Namespace.Get() 173 } 174 return toSerialize, nil 175 } 176 177 type NullableComponentResourceItem struct { 178 value *ComponentResourceItem 179 isSet bool 180 } 181 182 func (v NullableComponentResourceItem) Get() *ComponentResourceItem { 183 return v.value 184 } 185 186 func (v *NullableComponentResourceItem) Set(val *ComponentResourceItem) { 187 v.value = val 188 v.isSet = true 189 } 190 191 func (v NullableComponentResourceItem) IsSet() bool { 192 return v.isSet 193 } 194 195 func (v *NullableComponentResourceItem) Unset() { 196 v.value = nil 197 v.isSet = false 198 } 199 200 func NewNullableComponentResourceItem(val *ComponentResourceItem) *NullableComponentResourceItem { 201 return &NullableComponentResourceItem{value: val, isSet: true} 202 } 203 204 func (v NullableComponentResourceItem) MarshalJSON() ([]byte, error) { 205 return json.Marshal(v.value) 206 } 207 208 func (v *NullableComponentResourceItem) UnmarshalJSON(src []byte) error { 209 v.isSet = true 210 return json.Unmarshal(src, &v.value) 211 }