Skip to content

The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.

5.1 KB
Raw Blame
/*
BoxLite

BoxLite AI platform API Docs

API version: 1.0
Contact: [email protected]
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package apiclient

import (
	"encoding/json"
	"fmt"
)

// checks if the UpdateRegistryCredential type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UpdateRegistryCredential{}

// UpdateRegistryCredential struct for UpdateRegistryCredential
type UpdateRegistryCredential struct {
	// Username the registry expects
	Username string `json:"username"`
	// Password or access token. Never returned.
	Password string `json:"password"`
	AdditionalProperties map[string]interface{}
}

type _UpdateRegistryCredential UpdateRegistryCredential

// NewUpdateRegistryCredential instantiates a new UpdateRegistryCredential 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 NewUpdateRegistryCredential(username string, password string) *UpdateRegistryCredential {
	this := UpdateRegistryCredential{}
	this.Username = username
	this.Password = password
	return &this
}

// NewUpdateRegistryCredentialWithDefaults instantiates a new UpdateRegistryCredential 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 NewUpdateRegistryCredentialWithDefaults() *UpdateRegistryCredential {
	this := UpdateRegistryCredential{}
	return &this
}

// GetUsername returns the Username field value
func (o *UpdateRegistryCredential) GetUsername() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Username
}

// GetUsernameOk returns a tuple with the Username field value
// and a boolean to check if the value has been set.
func (o *UpdateRegistryCredential) GetUsernameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Username, true
}

// SetUsername sets field value
func (o *UpdateRegistryCredential) SetUsername(v string) {
	o.Username = v
}

// GetPassword returns the Password field value
func (o *UpdateRegistryCredential) GetPassword() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Password
}

// GetPasswordOk returns a tuple with the Password field value
// and a boolean to check if the value has been set.
func (o *UpdateRegistryCredential) GetPasswordOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Password, true
}

// SetPassword sets field value
func (o *UpdateRegistryCredential) SetPassword(v string) {
	o.Password = v
}

func (o UpdateRegistryCredential) MarshalJSON() ([]byte, error) {
	toSerialize,err := o.ToMap()
	if err != nil {
		return []byte{}, err
	}
	return json.Marshal(toSerialize)
}

func (o UpdateRegistryCredential) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["username"] = o.Username
	toSerialize["password"] = o.Password

	for key, value := range o.AdditionalProperties {
		toSerialize[key] = value
	}

	return toSerialize, nil
}

func (o *UpdateRegistryCredential) UnmarshalJSON(data []byte) (err error) {
	// This validates that all required properties are included in the JSON object
	// by unmarshalling the object into a generic map with string keys and checking
	// that every required field exists as a key in the generic map.
	requiredProperties := []string{
		"username",
		"password",
	}

	allProperties := make(map[string]interface{})

	err = json.Unmarshal(data, &allProperties)

	if err != nil {
		return err;
	}

	for _, requiredProperty := range(requiredProperties) {
		if _, exists := allProperties[requiredProperty]; !exists {
			return fmt.Errorf("no value given for required property %v", requiredProperty)
		}
	}

	varUpdateRegistryCredential := _UpdateRegistryCredential{}

	err = json.Unmarshal(data, &varUpdateRegistryCredential)

	if err != nil {
		return err
	}

	*o = UpdateRegistryCredential(varUpdateRegistryCredential)

	additionalProperties := make(map[string]interface{})

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "username")
		delete(additionalProperties, "password")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableUpdateRegistryCredential struct {
	value *UpdateRegistryCredential
	isSet bool
}

func (v NullableUpdateRegistryCredential) Get() *UpdateRegistryCredential {
	return v.value
}

func (v *NullableUpdateRegistryCredential) Set(val *UpdateRegistryCredential) {
	v.value = val
	v.isSet = true
}

func (v NullableUpdateRegistryCredential) IsSet() bool {
	return v.isSet
}

func (v *NullableUpdateRegistryCredential) Unset() {
	v.value = nil
	v.isSet = false
}

func NewNullableUpdateRegistryCredential(val *UpdateRegistryCredential) *NullableUpdateRegistryCredential {
	return &NullableUpdateRegistryCredential{value: val, isSet: true}
}

func (v NullableUpdateRegistryCredential) MarshalJSON() ([]byte, error) {
	return json.Marshal(v.value)
}

func (v *NullableUpdateRegistryCredential) UnmarshalJSON(src []byte) error {
	v.isSet = true
	return json.Unmarshal(src, &v.value)
}