Skip to content

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

8.6 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 RegistryCredential type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &RegistryCredential{}

// RegistryCredential struct for RegistryCredential
type RegistryCredential struct {
	Id string `json:"id"`
	Kind RegistryCredentialKind `json:"kind"`
	RegistryHost string `json:"registryHost"`
	// Empty for the whole registry
	RepositoryPrefix string `json:"repositoryPrefix"`
	Username string `json:"username"`
	// The user who added it
	CreatedBy NullableString `json:"createdBy"`
	CreatedAt string `json:"createdAt"`
	AdditionalProperties map[string]interface{}
}

type _RegistryCredential RegistryCredential

// NewRegistryCredential instantiates a new RegistryCredential 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 NewRegistryCredential(id string, kind RegistryCredentialKind, registryHost string, repositoryPrefix string, username string, createdBy NullableString, createdAt string) *RegistryCredential {
	this := RegistryCredential{}
	this.Id = id
	this.Kind = kind
	this.RegistryHost = registryHost
	this.RepositoryPrefix = repositoryPrefix
	this.Username = username
	this.CreatedBy = createdBy
	this.CreatedAt = createdAt
	return &this
}

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

// GetId returns the Id field value
func (o *RegistryCredential) GetId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Id
}

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

// SetId sets field value
func (o *RegistryCredential) SetId(v string) {
	o.Id = v
}

// GetKind returns the Kind field value
func (o *RegistryCredential) GetKind() RegistryCredentialKind {
	if o == nil {
		var ret RegistryCredentialKind
		return ret
	}

	return o.Kind
}

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

// SetKind sets field value
func (o *RegistryCredential) SetKind(v RegistryCredentialKind) {
	o.Kind = v
}

// GetRegistryHost returns the RegistryHost field value
func (o *RegistryCredential) GetRegistryHost() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.RegistryHost
}

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

// SetRegistryHost sets field value
func (o *RegistryCredential) SetRegistryHost(v string) {
	o.RegistryHost = v
}

// GetRepositoryPrefix returns the RepositoryPrefix field value
func (o *RegistryCredential) GetRepositoryPrefix() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.RepositoryPrefix
}

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

// SetRepositoryPrefix sets field value
func (o *RegistryCredential) SetRepositoryPrefix(v string) {
	o.RepositoryPrefix = v
}

// GetUsername returns the Username field value
func (o *RegistryCredential) 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 *RegistryCredential) GetUsernameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Username, true
}

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

// GetCreatedBy returns the CreatedBy field value
// If the value is explicit nil, the zero value for string will be returned
func (o *RegistryCredential) GetCreatedBy() string {
	if o == nil || o.CreatedBy.Get() == nil {
		var ret string
		return ret
	}

	return *o.CreatedBy.Get()
}

// GetCreatedByOk returns a tuple with the CreatedBy field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *RegistryCredential) GetCreatedByOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return o.CreatedBy.Get(), o.CreatedBy.IsSet()
}

// SetCreatedBy sets field value
func (o *RegistryCredential) SetCreatedBy(v string) {
	o.CreatedBy.Set(&v)
}

// GetCreatedAt returns the CreatedAt field value
func (o *RegistryCredential) GetCreatedAt() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.CreatedAt
}

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

// SetCreatedAt sets field value
func (o *RegistryCredential) SetCreatedAt(v string) {
	o.CreatedAt = v
}

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

func (o RegistryCredential) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["kind"] = o.Kind
	toSerialize["registryHost"] = o.RegistryHost
	toSerialize["repositoryPrefix"] = o.RepositoryPrefix
	toSerialize["username"] = o.Username
	toSerialize["createdBy"] = o.CreatedBy.Get()
	toSerialize["createdAt"] = o.CreatedAt

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

	return toSerialize, nil
}

func (o *RegistryCredential) 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{
		"id",
		"kind",
		"registryHost",
		"repositoryPrefix",
		"username",
		"createdBy",
		"createdAt",
	}

	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)
		}
	}

	varRegistryCredential := _RegistryCredential{}

	err = json.Unmarshal(data, &varRegistryCredential)

	if err != nil {
		return err
	}

	*o = RegistryCredential(varRegistryCredential)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "id")
		delete(additionalProperties, "kind")
		delete(additionalProperties, "registryHost")
		delete(additionalProperties, "repositoryPrefix")
		delete(additionalProperties, "username")
		delete(additionalProperties, "createdBy")
		delete(additionalProperties, "createdAt")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableRegistryCredential struct {
	value *RegistryCredential
	isSet bool
}

func (v NullableRegistryCredential) Get() *RegistryCredential {
	return v.value
}

func (v *NullableRegistryCredential) Set(val *RegistryCredential) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRegistryCredential(val *RegistryCredential) *NullableRegistryCredential {
	return &NullableRegistryCredential{value: val, isSet: true}
}

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

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