Files
apiclient/model_api_key_list.go
zeekayandHanzo Dev 9cfc3af66d the Go client for Hanzo Runtime
Generated from Runtime's OpenAPI document, and pure standard library — it
requires nothing else, so a caller pays only for this package.

It lives here rather than inside Runtime because a nested module is resolved
by the path it declares, and one declaring a path it does not sit at is
reachable by nobody: no proxy answers for it and no consumer can name it.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-14 08:41:09 -07:00

309 lines
7.3 KiB
Go

/*
Runtime
Runtime 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 (
"bytes"
"encoding/json"
"fmt"
"time"
)
// checks if the ApiKeyList type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &ApiKeyList{}
// ApiKeyList struct for ApiKeyList
type ApiKeyList struct {
// The name of the API key
Name string `json:"name"`
// The masked API key value
Value string `json:"value"`
// When the API key was created
CreatedAt time.Time `json:"createdAt"`
// The list of organization resource permissions assigned to the API key
Permissions []string `json:"permissions"`
// When the API key was last used
LastUsedAt NullableTime `json:"lastUsedAt"`
// When the API key expires
ExpiresAt NullableTime `json:"expiresAt"`
}
type _ApiKeyList ApiKeyList
// NewApiKeyList instantiates a new ApiKeyList 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 NewApiKeyList(name string, value string, createdAt time.Time, permissions []string, lastUsedAt NullableTime, expiresAt NullableTime) *ApiKeyList {
this := ApiKeyList{}
this.Name = name
this.Value = value
this.CreatedAt = createdAt
this.Permissions = permissions
this.LastUsedAt = lastUsedAt
this.ExpiresAt = expiresAt
return &this
}
// NewApiKeyListWithDefaults instantiates a new ApiKeyList 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 NewApiKeyListWithDefaults() *ApiKeyList {
this := ApiKeyList{}
return &this
}
// GetName returns the Name field value
func (o *ApiKeyList) GetName() string {
if o == nil {
var ret string
return ret
}
return o.Name
}
// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
func (o *ApiKeyList) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *ApiKeyList) SetName(v string) {
o.Name = v
}
// GetValue returns the Value field value
func (o *ApiKeyList) GetValue() string {
if o == nil {
var ret string
return ret
}
return o.Value
}
// GetValueOk returns a tuple with the Value field value
// and a boolean to check if the value has been set.
func (o *ApiKeyList) GetValueOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Value, true
}
// SetValue sets field value
func (o *ApiKeyList) SetValue(v string) {
o.Value = v
}
// GetCreatedAt returns the CreatedAt field value
func (o *ApiKeyList) GetCreatedAt() time.Time {
if o == nil {
var ret time.Time
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 *ApiKeyList) GetCreatedAtOk() (*time.Time, bool) {
if o == nil {
return nil, false
}
return &o.CreatedAt, true
}
// SetCreatedAt sets field value
func (o *ApiKeyList) SetCreatedAt(v time.Time) {
o.CreatedAt = v
}
// GetPermissions returns the Permissions field value
func (o *ApiKeyList) GetPermissions() []string {
if o == nil {
var ret []string
return ret
}
return o.Permissions
}
// GetPermissionsOk returns a tuple with the Permissions field value
// and a boolean to check if the value has been set.
func (o *ApiKeyList) GetPermissionsOk() ([]string, bool) {
if o == nil {
return nil, false
}
return o.Permissions, true
}
// SetPermissions sets field value
func (o *ApiKeyList) SetPermissions(v []string) {
o.Permissions = v
}
// GetLastUsedAt returns the LastUsedAt field value
// If the value is explicit nil, the zero value for time.Time will be returned
func (o *ApiKeyList) GetLastUsedAt() time.Time {
if o == nil || o.LastUsedAt.Get() == nil {
var ret time.Time
return ret
}
return *o.LastUsedAt.Get()
}
// GetLastUsedAtOk returns a tuple with the LastUsedAt 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 *ApiKeyList) GetLastUsedAtOk() (*time.Time, bool) {
if o == nil {
return nil, false
}
return o.LastUsedAt.Get(), o.LastUsedAt.IsSet()
}
// SetLastUsedAt sets field value
func (o *ApiKeyList) SetLastUsedAt(v time.Time) {
o.LastUsedAt.Set(&v)
}
// GetExpiresAt returns the ExpiresAt field value
// If the value is explicit nil, the zero value for time.Time will be returned
func (o *ApiKeyList) GetExpiresAt() time.Time {
if o == nil || o.ExpiresAt.Get() == nil {
var ret time.Time
return ret
}
return *o.ExpiresAt.Get()
}
// GetExpiresAtOk returns a tuple with the ExpiresAt 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 *ApiKeyList) GetExpiresAtOk() (*time.Time, bool) {
if o == nil {
return nil, false
}
return o.ExpiresAt.Get(), o.ExpiresAt.IsSet()
}
// SetExpiresAt sets field value
func (o *ApiKeyList) SetExpiresAt(v time.Time) {
o.ExpiresAt.Set(&v)
}
func (o ApiKeyList) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o ApiKeyList) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["name"] = o.Name
toSerialize["value"] = o.Value
toSerialize["createdAt"] = o.CreatedAt
toSerialize["permissions"] = o.Permissions
toSerialize["lastUsedAt"] = o.LastUsedAt.Get()
toSerialize["expiresAt"] = o.ExpiresAt.Get()
return toSerialize, nil
}
func (o *ApiKeyList) 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{
"name",
"value",
"createdAt",
"permissions",
"lastUsedAt",
"expiresAt",
}
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)
}
}
varApiKeyList := _ApiKeyList{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varApiKeyList)
if err != nil {
return err
}
*o = ApiKeyList(varApiKeyList)
return err
}
type NullableApiKeyList struct {
value *ApiKeyList
isSet bool
}
func (v NullableApiKeyList) Get() *ApiKeyList {
return v.value
}
func (v *NullableApiKeyList) Set(val *ApiKeyList) {
v.value = val
v.isSet = true
}
func (v NullableApiKeyList) IsSet() bool {
return v.isSet
}
func (v *NullableApiKeyList) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableApiKeyList(val *ApiKeyList) *NullableApiKeyList {
return &NullableApiKeyList{value: val, isSet: true}
}
func (v NullableApiKeyList) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableApiKeyList) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}