bunnyshell.com/sdk@v0.16.0/model_problem_generic.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 ProblemGeneric type satisfies the MappedNullable interface at compile time
    19  var _ MappedNullable = &ProblemGeneric{}
    20  
    21  // ProblemGeneric Generic Error
    22  type ProblemGeneric struct {
    23  	Title      *string            `json:"title,omitempty"`
    24  	Detail     *string            `json:"detail,omitempty"`
    25  	Violations []ProblemViolation `json:"violations,omitempty"`
    26  }
    27  
    28  // NewProblemGeneric instantiates a new ProblemGeneric object
    29  // This constructor will assign default values to properties that have it defined,
    30  // and makes sure properties required by API are set, but the set of arguments
    31  // will change when the set of required properties is changed
    32  func NewProblemGeneric() *ProblemGeneric {
    33  	this := ProblemGeneric{}
    34  	return &this
    35  }
    36  
    37  // NewProblemGenericWithDefaults instantiates a new ProblemGeneric object
    38  // This constructor will only assign default values to properties that have it defined,
    39  // but it doesn't guarantee that properties required by API are set
    40  func NewProblemGenericWithDefaults() *ProblemGeneric {
    41  	this := ProblemGeneric{}
    42  	return &this
    43  }
    44  
    45  // GetTitle returns the Title field value if set, zero value otherwise.
    46  func (o *ProblemGeneric) GetTitle() string {
    47  	if o == nil || IsNil(o.Title) {
    48  		var ret string
    49  		return ret
    50  	}
    51  	return *o.Title
    52  }
    53  
    54  // GetTitleOk returns a tuple with the Title field value if set, nil otherwise
    55  // and a boolean to check if the value has been set.
    56  func (o *ProblemGeneric) GetTitleOk() (*string, bool) {
    57  	if o == nil || IsNil(o.Title) {
    58  		return nil, false
    59  	}
    60  	return o.Title, true
    61  }
    62  
    63  // HasTitle returns a boolean if a field has been set.
    64  func (o *ProblemGeneric) HasTitle() bool {
    65  	if o != nil && !IsNil(o.Title) {
    66  		return true
    67  	}
    68  
    69  	return false
    70  }
    71  
    72  // SetTitle gets a reference to the given string and assigns it to the Title field.
    73  func (o *ProblemGeneric) SetTitle(v string) {
    74  	o.Title = &v
    75  }
    76  
    77  // GetDetail returns the Detail field value if set, zero value otherwise.
    78  func (o *ProblemGeneric) GetDetail() string {
    79  	if o == nil || IsNil(o.Detail) {
    80  		var ret string
    81  		return ret
    82  	}
    83  	return *o.Detail
    84  }
    85  
    86  // GetDetailOk returns a tuple with the Detail field value if set, nil otherwise
    87  // and a boolean to check if the value has been set.
    88  func (o *ProblemGeneric) GetDetailOk() (*string, bool) {
    89  	if o == nil || IsNil(o.Detail) {
    90  		return nil, false
    91  	}
    92  	return o.Detail, true
    93  }
    94  
    95  // HasDetail returns a boolean if a field has been set.
    96  func (o *ProblemGeneric) HasDetail() bool {
    97  	if o != nil && !IsNil(o.Detail) {
    98  		return true
    99  	}
   100  
   101  	return false
   102  }
   103  
   104  // SetDetail gets a reference to the given string and assigns it to the Detail field.
   105  func (o *ProblemGeneric) SetDetail(v string) {
   106  	o.Detail = &v
   107  }
   108  
   109  // GetViolations returns the Violations field value if set, zero value otherwise (both if not set or set to explicit null).
   110  func (o *ProblemGeneric) GetViolations() []ProblemViolation {
   111  	if o == nil {
   112  		var ret []ProblemViolation
   113  		return ret
   114  	}
   115  	return o.Violations
   116  }
   117  
   118  // GetViolationsOk returns a tuple with the Violations field value if set, nil otherwise
   119  // and a boolean to check if the value has been set.
   120  // NOTE: If the value is an explicit nil, `nil, true` will be returned
   121  func (o *ProblemGeneric) GetViolationsOk() ([]ProblemViolation, bool) {
   122  	if o == nil || IsNil(o.Violations) {
   123  		return nil, false
   124  	}
   125  	return o.Violations, true
   126  }
   127  
   128  // HasViolations returns a boolean if a field has been set.
   129  func (o *ProblemGeneric) HasViolations() bool {
   130  	if o != nil && IsNil(o.Violations) {
   131  		return true
   132  	}
   133  
   134  	return false
   135  }
   136  
   137  // SetViolations gets a reference to the given []ProblemViolation and assigns it to the Violations field.
   138  func (o *ProblemGeneric) SetViolations(v []ProblemViolation) {
   139  	o.Violations = v
   140  }
   141  
   142  func (o ProblemGeneric) MarshalJSON() ([]byte, error) {
   143  	toSerialize, err := o.ToMap()
   144  	if err != nil {
   145  		return []byte{}, err
   146  	}
   147  	return json.Marshal(toSerialize)
   148  }
   149  
   150  func (o ProblemGeneric) ToMap() (map[string]interface{}, error) {
   151  	toSerialize := map[string]interface{}{}
   152  	if !IsNil(o.Title) {
   153  		toSerialize["title"] = o.Title
   154  	}
   155  	if !IsNil(o.Detail) {
   156  		toSerialize["detail"] = o.Detail
   157  	}
   158  	if o.Violations != nil {
   159  		toSerialize["violations"] = o.Violations
   160  	}
   161  	return toSerialize, nil
   162  }
   163  
   164  type NullableProblemGeneric struct {
   165  	value *ProblemGeneric
   166  	isSet bool
   167  }
   168  
   169  func (v NullableProblemGeneric) Get() *ProblemGeneric {
   170  	return v.value
   171  }
   172  
   173  func (v *NullableProblemGeneric) Set(val *ProblemGeneric) {
   174  	v.value = val
   175  	v.isSet = true
   176  }
   177  
   178  func (v NullableProblemGeneric) IsSet() bool {
   179  	return v.isSet
   180  }
   181  
   182  func (v *NullableProblemGeneric) Unset() {
   183  	v.value = nil
   184  	v.isSet = false
   185  }
   186  
   187  func NewNullableProblemGeneric(val *ProblemGeneric) *NullableProblemGeneric {
   188  	return &NullableProblemGeneric{value: val, isSet: true}
   189  }
   190  
   191  func (v NullableProblemGeneric) MarshalJSON() ([]byte, error) {
   192  	return json.Marshal(v.value)
   193  }
   194  
   195  func (v *NullableProblemGeneric) UnmarshalJSON(src []byte) error {
   196  	v.isSet = true
   197  	return json.Unmarshal(src, &v.value)
   198  }