Skip to content

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

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

// CreateRegistryCredential struct for CreateRegistryCredential
type CreateRegistryCredential struct {
	// Registry the login is for
	RegistryHost string `json:"registryHost"`
	// Repositories it covers, as whole path segments ending in \"/\"; empty for the whole registry
	RepositoryPrefix *string `json:"repositoryPrefix,omitempty"`
	// Username the registry expects
	Username string `json:"username"`
	// Password or access token. Never returned.
	Password string `json:"password"`
	AdditionalProperties map[string]interface{}
}

type _CreateRegistryCredential CreateRegistryCredential

// NewCreateRegistryCredential instantiates a new CreateRegistryCredential 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 NewCreateRegistryCredential(registryHost string, username string, password string) *CreateRegistryCredential {
	this := CreateRegistryCredential{}
	this.RegistryHost = registryHost
	var repositoryPrefix string = ""
	this.RepositoryPrefix = &repositoryPrefix
	this.Username = username
	this.Password = password
	return &this
}

// NewCreateRegistryCredentialWithDefaults instantiates a new CreateRegistryCredential 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 NewCreateRegistryCredentialWithDefaults() *CreateRegistryCredential {
	this := CreateRegistryCredential{}
	var repositoryPrefix string = ""
	this.RepositoryPrefix = &repositoryPrefix
	return &this
}

// GetRegistryHost returns the RegistryHost field value
func (o *CreateRegistryCredential) 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 *CreateRegistryCredential) GetRegistryHostOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.RegistryHost, true
}

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

// GetRepositoryPrefix returns the RepositoryPrefix field value if set, zero value otherwise.
func (o *CreateRegistryCredential) GetRepositoryPrefix() string {
	if o == nil || IsNil(o.RepositoryPrefix) {
		var ret string
		return ret
	}
	return *o.RepositoryPrefix
}

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

// HasRepositoryPrefix returns a boolean if a field has been set.
func (o *CreateRegistryCredential) HasRepositoryPrefix() bool {
	if o != nil && !IsNil(o.RepositoryPrefix) {
		return true
	}

	return false
}

// SetRepositoryPrefix gets a reference to the given string and assigns it to the RepositoryPrefix field.
func (o *CreateRegistryCredential) SetRepositoryPrefix(v string) {
	o.RepositoryPrefix = &v
}

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

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

// GetPassword returns the Password field value
func (o *CreateRegistryCredential) 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 *CreateRegistryCredential) GetPasswordOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Password, true
}

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

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

func (o CreateRegistryCredential) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["registryHost"] = o.RegistryHost
	if !IsNil(o.RepositoryPrefix) {
		toSerialize["repositoryPrefix"] = o.RepositoryPrefix
	}
	toSerialize["username"] = o.Username
	toSerialize["password"] = o.Password

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

	return toSerialize, nil
}

func (o *CreateRegistryCredential) 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{
		"registryHost",
		"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)
		}
	}

	varCreateRegistryCredential := _CreateRegistryCredential{}

	err = json.Unmarshal(data, &varCreateRegistryCredential)

	if err != nil {
		return err
	}

	*o = CreateRegistryCredential(varCreateRegistryCredential)

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

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

	return err
}

type NullableCreateRegistryCredential struct {
	value *CreateRegistryCredential
	isSet bool
}

func (v NullableCreateRegistryCredential) Get() *CreateRegistryCredential {
	return v.value
}

func (v *NullableCreateRegistryCredential) Set(val *CreateRegistryCredential) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableCreateRegistryCredential(val *CreateRegistryCredential) *NullableCreateRegistryCredential {
	return &NullableCreateRegistryCredential{value: val, isSet: true}
}

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

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