Files
sdk/model_sync_patch_sync_in.go

383 lines
11 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"
)
// checks if the SyncPatchSyncIn type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &SyncPatchSyncIn{}
// SyncPatchSyncIn struct for SyncPatchSyncIn
type SyncPatchSyncIn struct {
// Actor is the loop-guard identity the sync writes as. Omitted, the stored actor stands.
Actor *string `json:"actor,omitempty"`
// Direction is both, pull, push or off. Omitted, the stored direction stands.
Direction *string `json:"direction,omitempty"`
// ID is the sync to update, from the path.
Id *string `json:"id,omitempty"`
// Kind names a different kind of sync, and is refused, for the same reason.
Kind *string `json:"kind,omitempty"`
// Source, Target and Kind are DECLARED HERE IN ORDER TO BE REFUSED. They are immutable by design — re-pointing a sync is a delete and a create, so a link can never silently start syncing somewhere else — but an UNDECLARED field is dropped by the binder before the handler sees it, so a request asking to repoint answered 200, changed nothing, and said nothing. The operator then believes a moved repository has been repointed and it has not. Live: a sync still naming github.com/hanzoai/cloud after the repository moved to hanzo-inc/cloud failed every reconcile with \"Repository not found\", and the PATCH that appeared to fix it did nothing at all. Declaring the fields is what lets the documented immutability actually answer. Source names a new upstream, and is refused. Delete this sync and create the one you want.
Source *SyncEndpointReq `json:"source,omitempty"`
// Target names a new native repository, and is refused, for the same reason.
Target *SyncEndpointReq `json:"target,omitempty"`
// Trigger is webhook, poll or manual. Omitted, the stored trigger stands.
Trigger *string `json:"trigger,omitempty"`
AdditionalProperties map[string]interface{}
}
type _SyncPatchSyncIn SyncPatchSyncIn
// NewSyncPatchSyncIn instantiates a new SyncPatchSyncIn 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 NewSyncPatchSyncIn() *SyncPatchSyncIn {
this := SyncPatchSyncIn{}
return &this
}
// NewSyncPatchSyncInWithDefaults instantiates a new SyncPatchSyncIn 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 NewSyncPatchSyncInWithDefaults() *SyncPatchSyncIn {
this := SyncPatchSyncIn{}
return &this
}
// GetActor returns the Actor field value if set, zero value otherwise.
func (o *SyncPatchSyncIn) GetActor() string {
if o == nil || IsNil(o.Actor) {
var ret string
return ret
}
return *o.Actor
}
// GetActorOk returns a tuple with the Actor field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyncPatchSyncIn) GetActorOk() (*string, bool) {
if o == nil || IsNil(o.Actor) {
return nil, false
}
return o.Actor, true
}
// HasActor returns a boolean if a field has been set.
func (o *SyncPatchSyncIn) HasActor() bool {
if o != nil && !IsNil(o.Actor) {
return true
}
return false
}
// SetActor gets a reference to the given string and assigns it to the Actor field.
func (o *SyncPatchSyncIn) SetActor(v string) {
o.Actor = &v
}
// GetDirection returns the Direction field value if set, zero value otherwise.
func (o *SyncPatchSyncIn) GetDirection() string {
if o == nil || IsNil(o.Direction) {
var ret string
return ret
}
return *o.Direction
}
// GetDirectionOk returns a tuple with the Direction field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyncPatchSyncIn) GetDirectionOk() (*string, bool) {
if o == nil || IsNil(o.Direction) {
return nil, false
}
return o.Direction, true
}
// HasDirection returns a boolean if a field has been set.
func (o *SyncPatchSyncIn) HasDirection() bool {
if o != nil && !IsNil(o.Direction) {
return true
}
return false
}
// SetDirection gets a reference to the given string and assigns it to the Direction field.
func (o *SyncPatchSyncIn) SetDirection(v string) {
o.Direction = &v
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *SyncPatchSyncIn) GetId() string {
if o == nil || IsNil(o.Id) {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyncPatchSyncIn) GetIdOk() (*string, bool) {
if o == nil || IsNil(o.Id) {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *SyncPatchSyncIn) HasId() bool {
if o != nil && !IsNil(o.Id) {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *SyncPatchSyncIn) SetId(v string) {
o.Id = &v
}
// GetKind returns the Kind field value if set, zero value otherwise.
func (o *SyncPatchSyncIn) GetKind() string {
if o == nil || IsNil(o.Kind) {
var ret string
return ret
}
return *o.Kind
}
// GetKindOk returns a tuple with the Kind field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyncPatchSyncIn) GetKindOk() (*string, bool) {
if o == nil || IsNil(o.Kind) {
return nil, false
}
return o.Kind, true
}
// HasKind returns a boolean if a field has been set.
func (o *SyncPatchSyncIn) HasKind() bool {
if o != nil && !IsNil(o.Kind) {
return true
}
return false
}
// SetKind gets a reference to the given string and assigns it to the Kind field.
func (o *SyncPatchSyncIn) SetKind(v string) {
o.Kind = &v
}
// GetSource returns the Source field value if set, zero value otherwise.
func (o *SyncPatchSyncIn) GetSource() SyncEndpointReq {
if o == nil || IsNil(o.Source) {
var ret SyncEndpointReq
return ret
}
return *o.Source
}
// GetSourceOk returns a tuple with the Source field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyncPatchSyncIn) GetSourceOk() (*SyncEndpointReq, bool) {
if o == nil || IsNil(o.Source) {
return nil, false
}
return o.Source, true
}
// HasSource returns a boolean if a field has been set.
func (o *SyncPatchSyncIn) HasSource() bool {
if o != nil && !IsNil(o.Source) {
return true
}
return false
}
// SetSource gets a reference to the given SyncEndpointReq and assigns it to the Source field.
func (o *SyncPatchSyncIn) SetSource(v SyncEndpointReq) {
o.Source = &v
}
// GetTarget returns the Target field value if set, zero value otherwise.
func (o *SyncPatchSyncIn) GetTarget() SyncEndpointReq {
if o == nil || IsNil(o.Target) {
var ret SyncEndpointReq
return ret
}
return *o.Target
}
// GetTargetOk returns a tuple with the Target field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyncPatchSyncIn) GetTargetOk() (*SyncEndpointReq, bool) {
if o == nil || IsNil(o.Target) {
return nil, false
}
return o.Target, true
}
// HasTarget returns a boolean if a field has been set.
func (o *SyncPatchSyncIn) HasTarget() bool {
if o != nil && !IsNil(o.Target) {
return true
}
return false
}
// SetTarget gets a reference to the given SyncEndpointReq and assigns it to the Target field.
func (o *SyncPatchSyncIn) SetTarget(v SyncEndpointReq) {
o.Target = &v
}
// GetTrigger returns the Trigger field value if set, zero value otherwise.
func (o *SyncPatchSyncIn) GetTrigger() string {
if o == nil || IsNil(o.Trigger) {
var ret string
return ret
}
return *o.Trigger
}
// GetTriggerOk returns a tuple with the Trigger field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SyncPatchSyncIn) GetTriggerOk() (*string, bool) {
if o == nil || IsNil(o.Trigger) {
return nil, false
}
return o.Trigger, true
}
// HasTrigger returns a boolean if a field has been set.
func (o *SyncPatchSyncIn) HasTrigger() bool {
if o != nil && !IsNil(o.Trigger) {
return true
}
return false
}
// SetTrigger gets a reference to the given string and assigns it to the Trigger field.
func (o *SyncPatchSyncIn) SetTrigger(v string) {
o.Trigger = &v
}
func (o SyncPatchSyncIn) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o SyncPatchSyncIn) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Actor) {
toSerialize["actor"] = o.Actor
}
if !IsNil(o.Direction) {
toSerialize["direction"] = o.Direction
}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
if !IsNil(o.Kind) {
toSerialize["kind"] = o.Kind
}
if !IsNil(o.Source) {
toSerialize["source"] = o.Source
}
if !IsNil(o.Target) {
toSerialize["target"] = o.Target
}
if !IsNil(o.Trigger) {
toSerialize["trigger"] = o.Trigger
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *SyncPatchSyncIn) UnmarshalJSON(data []byte) (err error) {
varSyncPatchSyncIn := _SyncPatchSyncIn{}
err = json.Unmarshal(data, &varSyncPatchSyncIn)
if err != nil {
return err
}
*o = SyncPatchSyncIn(varSyncPatchSyncIn)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "actor")
delete(additionalProperties, "direction")
delete(additionalProperties, "id")
delete(additionalProperties, "kind")
delete(additionalProperties, "source")
delete(additionalProperties, "target")
delete(additionalProperties, "trigger")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableSyncPatchSyncIn struct {
value *SyncPatchSyncIn
isSet bool
}
func (v NullableSyncPatchSyncIn) Get() *SyncPatchSyncIn {
return v.value
}
func (v *NullableSyncPatchSyncIn) Set(val *SyncPatchSyncIn) {
v.value = val
v.isSet = true
}
func (v NullableSyncPatchSyncIn) IsSet() bool {
return v.isSet
}
func (v *NullableSyncPatchSyncIn) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableSyncPatchSyncIn(val *SyncPatchSyncIn) *NullableSyncPatchSyncIn {
return &NullableSyncPatchSyncIn{value: val, isSet: true}
}
func (v NullableSyncPatchSyncIn) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableSyncPatchSyncIn) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}