bunnyshell.com/sdk@v0.16.0/model_stage_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 StageItem type satisfies the MappedNullable interface at compile time
    19  var _ MappedNullable = &StageItem{}
    20  
    21  // StageItem struct for StageItem
    22  type StageItem struct {
    23  	// Stage identifier.
    24  	Id *string `json:"id,omitempty"`
    25  	// Stage name.
    26  	Name *string `json:"name,omitempty"`
    27  	// Stage status.
    28  	Status *string `json:"status,omitempty"`
    29  	// Stage duration.
    30  	Duration NullableInt32 `json:"duration,omitempty"`
    31  	// Stage total jobs.
    32  	JobsCount *int32 `json:"jobsCount,omitempty"`
    33  	// Stage completed jobs.
    34  	CompletedJobsCount *int32 `json:"completedJobsCount,omitempty"`
    35  	// Event identifier.
    36  	Pipeline *string `json:"pipeline,omitempty"`
    37  }
    38  
    39  // NewStageItem instantiates a new StageItem object
    40  // This constructor will assign default values to properties that have it defined,
    41  // and makes sure properties required by API are set, but the set of arguments
    42  // will change when the set of required properties is changed
    43  func NewStageItem() *StageItem {
    44  	this := StageItem{}
    45  	return &this
    46  }
    47  
    48  // NewStageItemWithDefaults instantiates a new StageItem object
    49  // This constructor will only assign default values to properties that have it defined,
    50  // but it doesn't guarantee that properties required by API are set
    51  func NewStageItemWithDefaults() *StageItem {
    52  	this := StageItem{}
    53  	return &this
    54  }
    55  
    56  // GetId returns the Id field value if set, zero value otherwise.
    57  func (o *StageItem) GetId() string {
    58  	if o == nil || IsNil(o.Id) {
    59  		var ret string
    60  		return ret
    61  	}
    62  	return *o.Id
    63  }
    64  
    65  // GetIdOk returns a tuple with the Id field value if set, nil otherwise
    66  // and a boolean to check if the value has been set.
    67  func (o *StageItem) GetIdOk() (*string, bool) {
    68  	if o == nil || IsNil(o.Id) {
    69  		return nil, false
    70  	}
    71  	return o.Id, true
    72  }
    73  
    74  // HasId returns a boolean if a field has been set.
    75  func (o *StageItem) HasId() bool {
    76  	if o != nil && !IsNil(o.Id) {
    77  		return true
    78  	}
    79  
    80  	return false
    81  }
    82  
    83  // SetId gets a reference to the given string and assigns it to the Id field.
    84  func (o *StageItem) SetId(v string) {
    85  	o.Id = &v
    86  }
    87  
    88  // GetName returns the Name field value if set, zero value otherwise.
    89  func (o *StageItem) GetName() string {
    90  	if o == nil || IsNil(o.Name) {
    91  		var ret string
    92  		return ret
    93  	}
    94  	return *o.Name
    95  }
    96  
    97  // GetNameOk returns a tuple with the Name field value if set, nil otherwise
    98  // and a boolean to check if the value has been set.
    99  func (o *StageItem) GetNameOk() (*string, bool) {
   100  	if o == nil || IsNil(o.Name) {
   101  		return nil, false
   102  	}
   103  	return o.Name, true
   104  }
   105  
   106  // HasName returns a boolean if a field has been set.
   107  func (o *StageItem) HasName() bool {
   108  	if o != nil && !IsNil(o.Name) {
   109  		return true
   110  	}
   111  
   112  	return false
   113  }
   114  
   115  // SetName gets a reference to the given string and assigns it to the Name field.
   116  func (o *StageItem) SetName(v string) {
   117  	o.Name = &v
   118  }
   119  
   120  // GetStatus returns the Status field value if set, zero value otherwise.
   121  func (o *StageItem) GetStatus() string {
   122  	if o == nil || IsNil(o.Status) {
   123  		var ret string
   124  		return ret
   125  	}
   126  	return *o.Status
   127  }
   128  
   129  // GetStatusOk returns a tuple with the Status field value if set, nil otherwise
   130  // and a boolean to check if the value has been set.
   131  func (o *StageItem) GetStatusOk() (*string, bool) {
   132  	if o == nil || IsNil(o.Status) {
   133  		return nil, false
   134  	}
   135  	return o.Status, true
   136  }
   137  
   138  // HasStatus returns a boolean if a field has been set.
   139  func (o *StageItem) HasStatus() bool {
   140  	if o != nil && !IsNil(o.Status) {
   141  		return true
   142  	}
   143  
   144  	return false
   145  }
   146  
   147  // SetStatus gets a reference to the given string and assigns it to the Status field.
   148  func (o *StageItem) SetStatus(v string) {
   149  	o.Status = &v
   150  }
   151  
   152  // GetDuration returns the Duration field value if set, zero value otherwise (both if not set or set to explicit null).
   153  func (o *StageItem) GetDuration() int32 {
   154  	if o == nil || IsNil(o.Duration.Get()) {
   155  		var ret int32
   156  		return ret
   157  	}
   158  	return *o.Duration.Get()
   159  }
   160  
   161  // GetDurationOk returns a tuple with the Duration field value if set, nil otherwise
   162  // and a boolean to check if the value has been set.
   163  // NOTE: If the value is an explicit nil, `nil, true` will be returned
   164  func (o *StageItem) GetDurationOk() (*int32, bool) {
   165  	if o == nil {
   166  		return nil, false
   167  	}
   168  	return o.Duration.Get(), o.Duration.IsSet()
   169  }
   170  
   171  // HasDuration returns a boolean if a field has been set.
   172  func (o *StageItem) HasDuration() bool {
   173  	if o != nil && o.Duration.IsSet() {
   174  		return true
   175  	}
   176  
   177  	return false
   178  }
   179  
   180  // SetDuration gets a reference to the given NullableInt32 and assigns it to the Duration field.
   181  func (o *StageItem) SetDuration(v int32) {
   182  	o.Duration.Set(&v)
   183  }
   184  
   185  // SetDurationNil sets the value for Duration to be an explicit nil
   186  func (o *StageItem) SetDurationNil() {
   187  	o.Duration.Set(nil)
   188  }
   189  
   190  // UnsetDuration ensures that no value is present for Duration, not even an explicit nil
   191  func (o *StageItem) UnsetDuration() {
   192  	o.Duration.Unset()
   193  }
   194  
   195  // GetJobsCount returns the JobsCount field value if set, zero value otherwise.
   196  func (o *StageItem) GetJobsCount() int32 {
   197  	if o == nil || IsNil(o.JobsCount) {
   198  		var ret int32
   199  		return ret
   200  	}
   201  	return *o.JobsCount
   202  }
   203  
   204  // GetJobsCountOk returns a tuple with the JobsCount field value if set, nil otherwise
   205  // and a boolean to check if the value has been set.
   206  func (o *StageItem) GetJobsCountOk() (*int32, bool) {
   207  	if o == nil || IsNil(o.JobsCount) {
   208  		return nil, false
   209  	}
   210  	return o.JobsCount, true
   211  }
   212  
   213  // HasJobsCount returns a boolean if a field has been set.
   214  func (o *StageItem) HasJobsCount() bool {
   215  	if o != nil && !IsNil(o.JobsCount) {
   216  		return true
   217  	}
   218  
   219  	return false
   220  }
   221  
   222  // SetJobsCount gets a reference to the given int32 and assigns it to the JobsCount field.
   223  func (o *StageItem) SetJobsCount(v int32) {
   224  	o.JobsCount = &v
   225  }
   226  
   227  // GetCompletedJobsCount returns the CompletedJobsCount field value if set, zero value otherwise.
   228  func (o *StageItem) GetCompletedJobsCount() int32 {
   229  	if o == nil || IsNil(o.CompletedJobsCount) {
   230  		var ret int32
   231  		return ret
   232  	}
   233  	return *o.CompletedJobsCount
   234  }
   235  
   236  // GetCompletedJobsCountOk returns a tuple with the CompletedJobsCount field value if set, nil otherwise
   237  // and a boolean to check if the value has been set.
   238  func (o *StageItem) GetCompletedJobsCountOk() (*int32, bool) {
   239  	if o == nil || IsNil(o.CompletedJobsCount) {
   240  		return nil, false
   241  	}
   242  	return o.CompletedJobsCount, true
   243  }
   244  
   245  // HasCompletedJobsCount returns a boolean if a field has been set.
   246  func (o *StageItem) HasCompletedJobsCount() bool {
   247  	if o != nil && !IsNil(o.CompletedJobsCount) {
   248  		return true
   249  	}
   250  
   251  	return false
   252  }
   253  
   254  // SetCompletedJobsCount gets a reference to the given int32 and assigns it to the CompletedJobsCount field.
   255  func (o *StageItem) SetCompletedJobsCount(v int32) {
   256  	o.CompletedJobsCount = &v
   257  }
   258  
   259  // GetPipeline returns the Pipeline field value if set, zero value otherwise.
   260  func (o *StageItem) GetPipeline() string {
   261  	if o == nil || IsNil(o.Pipeline) {
   262  		var ret string
   263  		return ret
   264  	}
   265  	return *o.Pipeline
   266  }
   267  
   268  // GetPipelineOk returns a tuple with the Pipeline field value if set, nil otherwise
   269  // and a boolean to check if the value has been set.
   270  func (o *StageItem) GetPipelineOk() (*string, bool) {
   271  	if o == nil || IsNil(o.Pipeline) {
   272  		return nil, false
   273  	}
   274  	return o.Pipeline, true
   275  }
   276  
   277  // HasPipeline returns a boolean if a field has been set.
   278  func (o *StageItem) HasPipeline() bool {
   279  	if o != nil && !IsNil(o.Pipeline) {
   280  		return true
   281  	}
   282  
   283  	return false
   284  }
   285  
   286  // SetPipeline gets a reference to the given string and assigns it to the Pipeline field.
   287  func (o *StageItem) SetPipeline(v string) {
   288  	o.Pipeline = &v
   289  }
   290  
   291  func (o StageItem) MarshalJSON() ([]byte, error) {
   292  	toSerialize, err := o.ToMap()
   293  	if err != nil {
   294  		return []byte{}, err
   295  	}
   296  	return json.Marshal(toSerialize)
   297  }
   298  
   299  func (o StageItem) ToMap() (map[string]interface{}, error) {
   300  	toSerialize := map[string]interface{}{}
   301  	if !IsNil(o.Id) {
   302  		toSerialize["id"] = o.Id
   303  	}
   304  	if !IsNil(o.Name) {
   305  		toSerialize["name"] = o.Name
   306  	}
   307  	if !IsNil(o.Status) {
   308  		toSerialize["status"] = o.Status
   309  	}
   310  	if o.Duration.IsSet() {
   311  		toSerialize["duration"] = o.Duration.Get()
   312  	}
   313  	if !IsNil(o.JobsCount) {
   314  		toSerialize["jobsCount"] = o.JobsCount
   315  	}
   316  	if !IsNil(o.CompletedJobsCount) {
   317  		toSerialize["completedJobsCount"] = o.CompletedJobsCount
   318  	}
   319  	if !IsNil(o.Pipeline) {
   320  		toSerialize["pipeline"] = o.Pipeline
   321  	}
   322  	return toSerialize, nil
   323  }
   324  
   325  type NullableStageItem struct {
   326  	value *StageItem
   327  	isSet bool
   328  }
   329  
   330  func (v NullableStageItem) Get() *StageItem {
   331  	return v.value
   332  }
   333  
   334  func (v *NullableStageItem) Set(val *StageItem) {
   335  	v.value = val
   336  	v.isSet = true
   337  }
   338  
   339  func (v NullableStageItem) IsSet() bool {
   340  	return v.isSet
   341  }
   342  
   343  func (v *NullableStageItem) Unset() {
   344  	v.value = nil
   345  	v.isSet = false
   346  }
   347  
   348  func NewNullableStageItem(val *StageItem) *NullableStageItem {
   349  	return &NullableStageItem{value: val, isSet: true}
   350  }
   351  
   352  func (v NullableStageItem) MarshalJSON() ([]byte, error) {
   353  	return json.Marshal(v.value)
   354  }
   355  
   356  func (v *NullableStageItem) UnmarshalJSON(src []byte) error {
   357  	v.isSet = true
   358  	return json.Unmarshal(src, &v.value)
   359  }