325 lines
8.8 KiB
Go
325 lines
8.8 KiB
Go
/*
|
|
STACKIT Git API
|
|
|
|
STACKIT Git management API.
|
|
|
|
API version: 1beta.0.4
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package gitbeta
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
// checks if the PatchOperation type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &PatchOperation{}
|
|
|
|
/*
|
|
types and functions for op
|
|
*/
|
|
|
|
// isEnum
|
|
|
|
// PatchOperationOp The patch operation to perform.
|
|
// value type for enums
|
|
type PatchOperationOp string
|
|
|
|
// List of Op
|
|
const (
|
|
PATCHOPERATIONOP_ADD PatchOperationOp = "add"
|
|
PATCHOPERATIONOP_REMOVE PatchOperationOp = "remove"
|
|
)
|
|
|
|
// All allowed values of PatchOperation enum
|
|
var AllowedPatchOperationOpEnumValues = []PatchOperationOp{
|
|
"add",
|
|
"remove",
|
|
}
|
|
|
|
func (v *PatchOperationOp) UnmarshalJSON(src []byte) error {
|
|
// use a type alias to prevent infinite recursion during unmarshal,
|
|
// see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers
|
|
type TmpJson PatchOperationOp
|
|
var value TmpJson
|
|
err := json.Unmarshal(src, &value)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Allow unmarshalling zero value for testing purposes
|
|
var zeroValue TmpJson
|
|
if value == zeroValue {
|
|
return nil
|
|
}
|
|
enumTypeValue := PatchOperationOp(value)
|
|
for _, existing := range AllowedPatchOperationOpEnumValues {
|
|
if existing == enumTypeValue {
|
|
*v = enumTypeValue
|
|
return nil
|
|
}
|
|
}
|
|
|
|
return fmt.Errorf("%+v is not a valid PatchOperation", value)
|
|
}
|
|
|
|
// NewPatchOperationOpFromValue returns a pointer to a valid PatchOperationOp
|
|
// for the value passed as argument, or an error if the value passed is not allowed by the enum
|
|
func NewPatchOperationOpFromValue(v PatchOperationOp) (*PatchOperationOp, error) {
|
|
ev := PatchOperationOp(v)
|
|
if ev.IsValid() {
|
|
return &ev, nil
|
|
} else {
|
|
return nil, fmt.Errorf("invalid value '%v' for PatchOperationOp: valid values are %v", v, AllowedPatchOperationOpEnumValues)
|
|
}
|
|
}
|
|
|
|
// IsValid return true if the value is valid for the enum, false otherwise
|
|
func (v PatchOperationOp) IsValid() bool {
|
|
for _, existing := range AllowedPatchOperationOpEnumValues {
|
|
if existing == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// Ptr returns reference to OpOp value
|
|
func (v PatchOperationOp) Ptr() *PatchOperationOp {
|
|
return &v
|
|
}
|
|
|
|
type NullablePatchOperationOp struct {
|
|
value *PatchOperationOp
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullablePatchOperationOp) Get() *PatchOperationOp {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullablePatchOperationOp) Set(val *PatchOperationOp) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullablePatchOperationOp) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullablePatchOperationOp) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullablePatchOperationOp(val *PatchOperationOp) *NullablePatchOperationOp {
|
|
return &NullablePatchOperationOp{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullablePatchOperationOp) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullablePatchOperationOp) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|
|
|
|
type PatchOperationGetOpAttributeType = *PatchOperationOp
|
|
type PatchOperationGetOpArgType = PatchOperationOp
|
|
type PatchOperationGetOpRetType = PatchOperationOp
|
|
|
|
func getPatchOperationGetOpAttributeTypeOk(arg PatchOperationGetOpAttributeType) (ret PatchOperationGetOpRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setPatchOperationGetOpAttributeType(arg *PatchOperationGetOpAttributeType, val PatchOperationGetOpRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
/*
|
|
types and functions for path
|
|
*/
|
|
|
|
// isNotNullableString
|
|
type PatchOperationGetPathAttributeType = *string
|
|
|
|
func getPatchOperationGetPathAttributeTypeOk(arg PatchOperationGetPathAttributeType) (ret PatchOperationGetPathRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setPatchOperationGetPathAttributeType(arg *PatchOperationGetPathAttributeType, val PatchOperationGetPathRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
type PatchOperationGetPathArgType = string
|
|
type PatchOperationGetPathRetType = string
|
|
|
|
/*
|
|
types and functions for value
|
|
*/
|
|
|
|
// isNotNullableString
|
|
type PatchOperationGetValueAttributeType = *string
|
|
|
|
func getPatchOperationGetValueAttributeTypeOk(arg PatchOperationGetValueAttributeType) (ret PatchOperationGetValueRetType, ok bool) {
|
|
if arg == nil {
|
|
return ret, false
|
|
}
|
|
return *arg, true
|
|
}
|
|
|
|
func setPatchOperationGetValueAttributeType(arg *PatchOperationGetValueAttributeType, val PatchOperationGetValueRetType) {
|
|
*arg = &val
|
|
}
|
|
|
|
type PatchOperationGetValueArgType = string
|
|
type PatchOperationGetValueRetType = string
|
|
|
|
// PatchOperation Request a STACKIT Git instance to be patch with these properties.
|
|
type PatchOperation struct {
|
|
// The patch operation to perform.
|
|
// REQUIRED
|
|
Op PatchOperationGetOpAttributeType `json:"op" required:"true"`
|
|
// An RFC6901 JSON Pointer to the target location.
|
|
// REQUIRED
|
|
Path PatchOperationGetPathAttributeType `json:"path" required:"true"`
|
|
// The value to be used for 'add' and 'remove' operations.
|
|
Value PatchOperationGetValueAttributeType `json:"value,omitempty"`
|
|
}
|
|
|
|
type _PatchOperation PatchOperation
|
|
|
|
// NewPatchOperation instantiates a new PatchOperation 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 NewPatchOperation(op PatchOperationGetOpArgType, path PatchOperationGetPathArgType) *PatchOperation {
|
|
this := PatchOperation{}
|
|
setPatchOperationGetOpAttributeType(&this.Op, op)
|
|
setPatchOperationGetPathAttributeType(&this.Path, path)
|
|
return &this
|
|
}
|
|
|
|
// NewPatchOperationWithDefaults instantiates a new PatchOperation 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 NewPatchOperationWithDefaults() *PatchOperation {
|
|
this := PatchOperation{}
|
|
return &this
|
|
}
|
|
|
|
// GetOp returns the Op field value
|
|
func (o *PatchOperation) GetOp() (ret PatchOperationGetOpRetType) {
|
|
ret, _ = o.GetOpOk()
|
|
return ret
|
|
}
|
|
|
|
// GetOpOk returns a tuple with the Op field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *PatchOperation) GetOpOk() (ret PatchOperationGetOpRetType, ok bool) {
|
|
return getPatchOperationGetOpAttributeTypeOk(o.Op)
|
|
}
|
|
|
|
// SetOp sets field value
|
|
func (o *PatchOperation) SetOp(v PatchOperationGetOpRetType) {
|
|
setPatchOperationGetOpAttributeType(&o.Op, v)
|
|
}
|
|
|
|
// GetPath returns the Path field value
|
|
func (o *PatchOperation) GetPath() (ret PatchOperationGetPathRetType) {
|
|
ret, _ = o.GetPathOk()
|
|
return ret
|
|
}
|
|
|
|
// GetPathOk returns a tuple with the Path field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *PatchOperation) GetPathOk() (ret PatchOperationGetPathRetType, ok bool) {
|
|
return getPatchOperationGetPathAttributeTypeOk(o.Path)
|
|
}
|
|
|
|
// SetPath sets field value
|
|
func (o *PatchOperation) SetPath(v PatchOperationGetPathRetType) {
|
|
setPatchOperationGetPathAttributeType(&o.Path, v)
|
|
}
|
|
|
|
// GetValue returns the Value field value if set, zero value otherwise.
|
|
func (o *PatchOperation) GetValue() (res PatchOperationGetValueRetType) {
|
|
res, _ = o.GetValueOk()
|
|
return
|
|
}
|
|
|
|
// GetValueOk returns a tuple with the Value field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *PatchOperation) GetValueOk() (ret PatchOperationGetValueRetType, ok bool) {
|
|
return getPatchOperationGetValueAttributeTypeOk(o.Value)
|
|
}
|
|
|
|
// HasValue returns a boolean if a field has been set.
|
|
func (o *PatchOperation) HasValue() bool {
|
|
_, ok := o.GetValueOk()
|
|
return ok
|
|
}
|
|
|
|
// SetValue gets a reference to the given string and assigns it to the Value field.
|
|
func (o *PatchOperation) SetValue(v PatchOperationGetValueRetType) {
|
|
setPatchOperationGetValueAttributeType(&o.Value, v)
|
|
}
|
|
|
|
func (o PatchOperation) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
if val, ok := getPatchOperationGetOpAttributeTypeOk(o.Op); ok {
|
|
toSerialize["Op"] = val
|
|
}
|
|
if val, ok := getPatchOperationGetPathAttributeTypeOk(o.Path); ok {
|
|
toSerialize["Path"] = val
|
|
}
|
|
if val, ok := getPatchOperationGetValueAttributeTypeOk(o.Value); ok {
|
|
toSerialize["Value"] = val
|
|
}
|
|
return toSerialize, nil
|
|
}
|
|
|
|
type NullablePatchOperation struct {
|
|
value *PatchOperation
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullablePatchOperation) Get() *PatchOperation {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullablePatchOperation) Set(val *PatchOperation) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullablePatchOperation) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullablePatchOperation) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullablePatchOperation(val *PatchOperation) *NullablePatchOperation {
|
|
return &NullablePatchOperation{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullablePatchOperation) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullablePatchOperation) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|