Files
sdk/model_network_identity_in.go

193 lines
5.6 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
)
// checks if the NetworkIdentityIn type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &NetworkIdentityIn{}
// NetworkIdentityIn struct for NetworkIdentityIn
type NetworkIdentityIn struct {
// Name is the identity's name within the org — a DNS label, stored on the fabric as \"<name>.<org>\". Absent, the identity is named by the caller's IAM subject. It is set when the identity is first made; an identity that already exists keeps its name.
Name *string `json:"name,omitempty"`
// Roles are extra role attributes for the identity, each scoped to the caller's org on the way in (\"k3s-host\" is written as \"k3s-host.<org>\") so no caller can claim an attribute another tenant's policy selects. A role of the form \"<service>-host\" makes this identity a HOST of that published service — the bind policy from POST /v1/network/services selects exactly that attribute — and is refused when the org has no such service. Only a steward (an admin of the org or its own machine client) takes roles; a plain member asking for one is 403.
Roles []string `json:"roles,omitempty"`
AdditionalProperties map[string]interface{}
}
type _NetworkIdentityIn NetworkIdentityIn
// NewNetworkIdentityIn instantiates a new NetworkIdentityIn 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 NewNetworkIdentityIn() *NetworkIdentityIn {
this := NetworkIdentityIn{}
return &this
}
// NewNetworkIdentityInWithDefaults instantiates a new NetworkIdentityIn 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 NewNetworkIdentityInWithDefaults() *NetworkIdentityIn {
this := NetworkIdentityIn{}
return &this
}
// GetName returns the Name field value if set, zero value otherwise.
func (o *NetworkIdentityIn) GetName() string {
if o == nil || IsNil(o.Name) {
var ret string
return ret
}
return *o.Name
}
// GetNameOk returns a tuple with the Name field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *NetworkIdentityIn) GetNameOk() (*string, bool) {
if o == nil || IsNil(o.Name) {
return nil, false
}
return o.Name, true
}
// HasName returns a boolean if a field has been set.
func (o *NetworkIdentityIn) HasName() bool {
if o != nil && !IsNil(o.Name) {
return true
}
return false
}
// SetName gets a reference to the given string and assigns it to the Name field.
func (o *NetworkIdentityIn) SetName(v string) {
o.Name = &v
}
// GetRoles returns the Roles field value if set, zero value otherwise.
func (o *NetworkIdentityIn) GetRoles() []string {
if o == nil || IsNil(o.Roles) {
var ret []string
return ret
}
return o.Roles
}
// GetRolesOk returns a tuple with the Roles field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *NetworkIdentityIn) GetRolesOk() ([]string, bool) {
if o == nil || IsNil(o.Roles) {
return nil, false
}
return o.Roles, true
}
// HasRoles returns a boolean if a field has been set.
func (o *NetworkIdentityIn) HasRoles() bool {
if o != nil && !IsNil(o.Roles) {
return true
}
return false
}
// SetRoles gets a reference to the given []string and assigns it to the Roles field.
func (o *NetworkIdentityIn) SetRoles(v []string) {
o.Roles = v
}
func (o NetworkIdentityIn) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o NetworkIdentityIn) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Name) {
toSerialize["name"] = o.Name
}
if !IsNil(o.Roles) {
toSerialize["roles"] = o.Roles
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *NetworkIdentityIn) UnmarshalJSON(data []byte) (err error) {
varNetworkIdentityIn := _NetworkIdentityIn{}
err = json.Unmarshal(data, &varNetworkIdentityIn)
if err != nil {
return err
}
*o = NetworkIdentityIn(varNetworkIdentityIn)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "name")
delete(additionalProperties, "roles")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableNetworkIdentityIn struct {
value *NetworkIdentityIn
isSet bool
}
func (v NullableNetworkIdentityIn) Get() *NetworkIdentityIn {
return v.value
}
func (v *NullableNetworkIdentityIn) Set(val *NetworkIdentityIn) {
v.value = val
v.isSet = true
}
func (v NullableNetworkIdentityIn) IsSet() bool {
return v.isSet
}
func (v *NullableNetworkIdentityIn) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableNetworkIdentityIn(val *NetworkIdentityIn) *NullableNetworkIdentityIn {
return &NullableNetworkIdentityIn{value: val, isSet: true}
}
func (v NullableNetworkIdentityIn) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableNetworkIdentityIn) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}