Files
sdk/model_licensing_issue_request.go

358 lines
10 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"
"fmt"
)
// checks if the LicensingIssueRequest type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &LicensingIssueRequest{}
// LicensingIssueRequest struct for LicensingIssueRequest
type LicensingIssueRequest struct {
// Fingerprint is a previously-registered device binding value, as returned by POST /v1/licensing/fingerprint. Leave it empty and pass Signals to bind the device at issue time instead.
Fingerprint *string `json:"fingerprint,omitempty"`
// Holder overrides who the token is issued to; defaults to the caller's own validated subject. It NAMES the token's bearer and grants nothing on its own — the entitlement checked is always the caller's org's.
Holder *string `json:"holder,omitempty"`
// Product is the licensed commerce product the caller wants a token for.
Product string `json:"product"`
// Release scopes the token to one signed binary release, recorded as a \"release:<id>\" feature so a single bad release can be revoked on its own.
Release *string `json:"release,omitempty"`
// Signals binds the device at issue time, as an alternative to a pre-registered fingerprint. The raw signals are never stored or echoed — they are folded immediately into the one-way binding value.
Signals *LicensingDeviceSignals `json:"signals,omitempty"`
// TTLSeconds requests a token lifetime in seconds. It is clamped to the deployment maximum AND to the entitlement's own expiry — a token never outlives the subscription that paid for it.
TtlSeconds *int64 `json:"ttl_seconds,omitempty"`
AdditionalProperties map[string]interface{}
}
type _LicensingIssueRequest LicensingIssueRequest
// NewLicensingIssueRequest instantiates a new LicensingIssueRequest 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 NewLicensingIssueRequest(product string) *LicensingIssueRequest {
this := LicensingIssueRequest{}
this.Product = product
return &this
}
// NewLicensingIssueRequestWithDefaults instantiates a new LicensingIssueRequest 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 NewLicensingIssueRequestWithDefaults() *LicensingIssueRequest {
this := LicensingIssueRequest{}
return &this
}
// GetFingerprint returns the Fingerprint field value if set, zero value otherwise.
func (o *LicensingIssueRequest) GetFingerprint() string {
if o == nil || IsNil(o.Fingerprint) {
var ret string
return ret
}
return *o.Fingerprint
}
// GetFingerprintOk returns a tuple with the Fingerprint field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LicensingIssueRequest) GetFingerprintOk() (*string, bool) {
if o == nil || IsNil(o.Fingerprint) {
return nil, false
}
return o.Fingerprint, true
}
// HasFingerprint returns a boolean if a field has been set.
func (o *LicensingIssueRequest) HasFingerprint() bool {
if o != nil && !IsNil(o.Fingerprint) {
return true
}
return false
}
// SetFingerprint gets a reference to the given string and assigns it to the Fingerprint field.
func (o *LicensingIssueRequest) SetFingerprint(v string) {
o.Fingerprint = &v
}
// GetHolder returns the Holder field value if set, zero value otherwise.
func (o *LicensingIssueRequest) GetHolder() string {
if o == nil || IsNil(o.Holder) {
var ret string
return ret
}
return *o.Holder
}
// GetHolderOk returns a tuple with the Holder field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LicensingIssueRequest) GetHolderOk() (*string, bool) {
if o == nil || IsNil(o.Holder) {
return nil, false
}
return o.Holder, true
}
// HasHolder returns a boolean if a field has been set.
func (o *LicensingIssueRequest) HasHolder() bool {
if o != nil && !IsNil(o.Holder) {
return true
}
return false
}
// SetHolder gets a reference to the given string and assigns it to the Holder field.
func (o *LicensingIssueRequest) SetHolder(v string) {
o.Holder = &v
}
// GetProduct returns the Product field value
func (o *LicensingIssueRequest) GetProduct() string {
if o == nil {
var ret string
return ret
}
return o.Product
}
// GetProductOk returns a tuple with the Product field value
// and a boolean to check if the value has been set.
func (o *LicensingIssueRequest) GetProductOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Product, true
}
// SetProduct sets field value
func (o *LicensingIssueRequest) SetProduct(v string) {
o.Product = v
}
// GetRelease returns the Release field value if set, zero value otherwise.
func (o *LicensingIssueRequest) GetRelease() string {
if o == nil || IsNil(o.Release) {
var ret string
return ret
}
return *o.Release
}
// GetReleaseOk returns a tuple with the Release field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LicensingIssueRequest) GetReleaseOk() (*string, bool) {
if o == nil || IsNil(o.Release) {
return nil, false
}
return o.Release, true
}
// HasRelease returns a boolean if a field has been set.
func (o *LicensingIssueRequest) HasRelease() bool {
if o != nil && !IsNil(o.Release) {
return true
}
return false
}
// SetRelease gets a reference to the given string and assigns it to the Release field.
func (o *LicensingIssueRequest) SetRelease(v string) {
o.Release = &v
}
// GetSignals returns the Signals field value if set, zero value otherwise.
func (o *LicensingIssueRequest) GetSignals() LicensingDeviceSignals {
if o == nil || IsNil(o.Signals) {
var ret LicensingDeviceSignals
return ret
}
return *o.Signals
}
// GetSignalsOk returns a tuple with the Signals field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LicensingIssueRequest) GetSignalsOk() (*LicensingDeviceSignals, bool) {
if o == nil || IsNil(o.Signals) {
return nil, false
}
return o.Signals, true
}
// HasSignals returns a boolean if a field has been set.
func (o *LicensingIssueRequest) HasSignals() bool {
if o != nil && !IsNil(o.Signals) {
return true
}
return false
}
// SetSignals gets a reference to the given LicensingDeviceSignals and assigns it to the Signals field.
func (o *LicensingIssueRequest) SetSignals(v LicensingDeviceSignals) {
o.Signals = &v
}
// GetTtlSeconds returns the TtlSeconds field value if set, zero value otherwise.
func (o *LicensingIssueRequest) GetTtlSeconds() int64 {
if o == nil || IsNil(o.TtlSeconds) {
var ret int64
return ret
}
return *o.TtlSeconds
}
// GetTtlSecondsOk returns a tuple with the TtlSeconds field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LicensingIssueRequest) GetTtlSecondsOk() (*int64, bool) {
if o == nil || IsNil(o.TtlSeconds) {
return nil, false
}
return o.TtlSeconds, true
}
// HasTtlSeconds returns a boolean if a field has been set.
func (o *LicensingIssueRequest) HasTtlSeconds() bool {
if o != nil && !IsNil(o.TtlSeconds) {
return true
}
return false
}
// SetTtlSeconds gets a reference to the given int64 and assigns it to the TtlSeconds field.
func (o *LicensingIssueRequest) SetTtlSeconds(v int64) {
o.TtlSeconds = &v
}
func (o LicensingIssueRequest) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o LicensingIssueRequest) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Fingerprint) {
toSerialize["fingerprint"] = o.Fingerprint
}
if !IsNil(o.Holder) {
toSerialize["holder"] = o.Holder
}
toSerialize["product"] = o.Product
if !IsNil(o.Release) {
toSerialize["release"] = o.Release
}
if !IsNil(o.Signals) {
toSerialize["signals"] = o.Signals
}
if !IsNil(o.TtlSeconds) {
toSerialize["ttl_seconds"] = o.TtlSeconds
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *LicensingIssueRequest) 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{
"product",
}
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)
}
}
varLicensingIssueRequest := _LicensingIssueRequest{}
err = json.Unmarshal(data, &varLicensingIssueRequest)
if err != nil {
return err
}
*o = LicensingIssueRequest(varLicensingIssueRequest)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "fingerprint")
delete(additionalProperties, "holder")
delete(additionalProperties, "product")
delete(additionalProperties, "release")
delete(additionalProperties, "signals")
delete(additionalProperties, "ttl_seconds")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableLicensingIssueRequest struct {
value *LicensingIssueRequest
isSet bool
}
func (v NullableLicensingIssueRequest) Get() *LicensingIssueRequest {
return v.value
}
func (v *NullableLicensingIssueRequest) Set(val *LicensingIssueRequest) {
v.value = val
v.isSet = true
}
func (v NullableLicensingIssueRequest) IsSet() bool {
return v.isSet
}
func (v *NullableLicensingIssueRequest) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableLicensingIssueRequest(val *LicensingIssueRequest) *NullableLicensingIssueRequest {
return &NullableLicensingIssueRequest{value: val, isSet: true}
}
func (v NullableLicensingIssueRequest) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableLicensingIssueRequest) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}