Files
sdk/model_project_projects_upload_grant.go

345 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"
)
// checks if the ProjectProjectsUploadGrant type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &ProjectProjectsUploadGrant{}
// ProjectProjectsUploadGrant struct for ProjectProjectsUploadGrant
type ProjectProjectsUploadGrant struct {
// Copy is true when the completion of this deployment accepts copyFrom and copy. A client that does not see it uploads every object itself, since a server that ignores those fields would leave the copied keys missing.
Copy *bool `json:"copy,omitempty"`
// ExpiresAt is when the grant stops being accepted, as Unix seconds. It is short-lived by design and is handed out ONCE, on the response that queues the deployment — a later read of that deployment does not carry it, so a grant cannot be fetched again after the build it was minted for.
ExpiresAt *int64 `json:"expiresAt,omitempty"`
// Fields are form values every POST must carry VERBATIM, alongside `key` and `file`. The signature covers them, so altering any one of them — including widening the key to reach outside the prefix — invalidates the grant rather than extending it.
Fields map[string]string `json:"fields,omitempty"`
// MaxBytes bounds ONE object, not the upload as a whole.
MaxBytes *int64 `json:"maxBytes,omitempty"`
// Prefix is the only place this grant can write: the deployment's own key prefix. It authorizes WRITES ONLY, which is why completing a deployment reconciles the prefix against a manifest instead of letting CI delete.
Prefix *string `json:"prefix,omitempty"`
// URL is the address to POST each object to. It is signed for the PUBLIC endpoint, because the signature covers the host and CI posts from outside the cluster.
Url *string `json:"url,omitempty"`
AdditionalProperties map[string]interface{}
}
type _ProjectProjectsUploadGrant ProjectProjectsUploadGrant
// NewProjectProjectsUploadGrant instantiates a new ProjectProjectsUploadGrant 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 NewProjectProjectsUploadGrant() *ProjectProjectsUploadGrant {
this := ProjectProjectsUploadGrant{}
return &this
}
// NewProjectProjectsUploadGrantWithDefaults instantiates a new ProjectProjectsUploadGrant 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 NewProjectProjectsUploadGrantWithDefaults() *ProjectProjectsUploadGrant {
this := ProjectProjectsUploadGrant{}
return &this
}
// GetCopy returns the Copy field value if set, zero value otherwise.
func (o *ProjectProjectsUploadGrant) GetCopy() bool {
if o == nil || IsNil(o.Copy) {
var ret bool
return ret
}
return *o.Copy
}
// GetCopyOk returns a tuple with the Copy field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ProjectProjectsUploadGrant) GetCopyOk() (*bool, bool) {
if o == nil || IsNil(o.Copy) {
return nil, false
}
return o.Copy, true
}
// HasCopy returns a boolean if a field has been set.
func (o *ProjectProjectsUploadGrant) HasCopy() bool {
if o != nil && !IsNil(o.Copy) {
return true
}
return false
}
// SetCopy gets a reference to the given bool and assigns it to the Copy field.
func (o *ProjectProjectsUploadGrant) SetCopy(v bool) {
o.Copy = &v
}
// GetExpiresAt returns the ExpiresAt field value if set, zero value otherwise.
func (o *ProjectProjectsUploadGrant) GetExpiresAt() int64 {
if o == nil || IsNil(o.ExpiresAt) {
var ret int64
return ret
}
return *o.ExpiresAt
}
// GetExpiresAtOk returns a tuple with the ExpiresAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ProjectProjectsUploadGrant) GetExpiresAtOk() (*int64, bool) {
if o == nil || IsNil(o.ExpiresAt) {
return nil, false
}
return o.ExpiresAt, true
}
// HasExpiresAt returns a boolean if a field has been set.
func (o *ProjectProjectsUploadGrant) HasExpiresAt() bool {
if o != nil && !IsNil(o.ExpiresAt) {
return true
}
return false
}
// SetExpiresAt gets a reference to the given int64 and assigns it to the ExpiresAt field.
func (o *ProjectProjectsUploadGrant) SetExpiresAt(v int64) {
o.ExpiresAt = &v
}
// GetFields returns the Fields field value if set, zero value otherwise.
func (o *ProjectProjectsUploadGrant) GetFields() map[string]string {
if o == nil || IsNil(o.Fields) {
var ret map[string]string
return ret
}
return o.Fields
}
// GetFieldsOk returns a tuple with the Fields field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ProjectProjectsUploadGrant) GetFieldsOk() (map[string]string, bool) {
if o == nil || IsNil(o.Fields) {
return map[string]string{}, false
}
return o.Fields, true
}
// HasFields returns a boolean if a field has been set.
func (o *ProjectProjectsUploadGrant) HasFields() bool {
if o != nil && !IsNil(o.Fields) {
return true
}
return false
}
// SetFields gets a reference to the given map[string]string and assigns it to the Fields field.
func (o *ProjectProjectsUploadGrant) SetFields(v map[string]string) {
o.Fields = v
}
// GetMaxBytes returns the MaxBytes field value if set, zero value otherwise.
func (o *ProjectProjectsUploadGrant) GetMaxBytes() int64 {
if o == nil || IsNil(o.MaxBytes) {
var ret int64
return ret
}
return *o.MaxBytes
}
// GetMaxBytesOk returns a tuple with the MaxBytes field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ProjectProjectsUploadGrant) GetMaxBytesOk() (*int64, bool) {
if o == nil || IsNil(o.MaxBytes) {
return nil, false
}
return o.MaxBytes, true
}
// HasMaxBytes returns a boolean if a field has been set.
func (o *ProjectProjectsUploadGrant) HasMaxBytes() bool {
if o != nil && !IsNil(o.MaxBytes) {
return true
}
return false
}
// SetMaxBytes gets a reference to the given int64 and assigns it to the MaxBytes field.
func (o *ProjectProjectsUploadGrant) SetMaxBytes(v int64) {
o.MaxBytes = &v
}
// GetPrefix returns the Prefix field value if set, zero value otherwise.
func (o *ProjectProjectsUploadGrant) GetPrefix() string {
if o == nil || IsNil(o.Prefix) {
var ret string
return ret
}
return *o.Prefix
}
// GetPrefixOk returns a tuple with the Prefix field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ProjectProjectsUploadGrant) GetPrefixOk() (*string, bool) {
if o == nil || IsNil(o.Prefix) {
return nil, false
}
return o.Prefix, true
}
// HasPrefix returns a boolean if a field has been set.
func (o *ProjectProjectsUploadGrant) HasPrefix() bool {
if o != nil && !IsNil(o.Prefix) {
return true
}
return false
}
// SetPrefix gets a reference to the given string and assigns it to the Prefix field.
func (o *ProjectProjectsUploadGrant) SetPrefix(v string) {
o.Prefix = &v
}
// GetUrl returns the Url field value if set, zero value otherwise.
func (o *ProjectProjectsUploadGrant) GetUrl() string {
if o == nil || IsNil(o.Url) {
var ret string
return ret
}
return *o.Url
}
// GetUrlOk returns a tuple with the Url field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ProjectProjectsUploadGrant) GetUrlOk() (*string, bool) {
if o == nil || IsNil(o.Url) {
return nil, false
}
return o.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (o *ProjectProjectsUploadGrant) HasUrl() bool {
if o != nil && !IsNil(o.Url) {
return true
}
return false
}
// SetUrl gets a reference to the given string and assigns it to the Url field.
func (o *ProjectProjectsUploadGrant) SetUrl(v string) {
o.Url = &v
}
func (o ProjectProjectsUploadGrant) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o ProjectProjectsUploadGrant) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Copy) {
toSerialize["copy"] = o.Copy
}
if !IsNil(o.ExpiresAt) {
toSerialize["expiresAt"] = o.ExpiresAt
}
if !IsNil(o.Fields) {
toSerialize["fields"] = o.Fields
}
if !IsNil(o.MaxBytes) {
toSerialize["maxBytes"] = o.MaxBytes
}
if !IsNil(o.Prefix) {
toSerialize["prefix"] = o.Prefix
}
if !IsNil(o.Url) {
toSerialize["url"] = o.Url
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *ProjectProjectsUploadGrant) UnmarshalJSON(data []byte) (err error) {
varProjectProjectsUploadGrant := _ProjectProjectsUploadGrant{}
err = json.Unmarshal(data, &varProjectProjectsUploadGrant)
if err != nil {
return err
}
*o = ProjectProjectsUploadGrant(varProjectProjectsUploadGrant)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "copy")
delete(additionalProperties, "expiresAt")
delete(additionalProperties, "fields")
delete(additionalProperties, "maxBytes")
delete(additionalProperties, "prefix")
delete(additionalProperties, "url")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableProjectProjectsUploadGrant struct {
value *ProjectProjectsUploadGrant
isSet bool
}
func (v NullableProjectProjectsUploadGrant) Get() *ProjectProjectsUploadGrant {
return v.value
}
func (v *NullableProjectProjectsUploadGrant) Set(val *ProjectProjectsUploadGrant) {
v.value = val
v.isSet = true
}
func (v NullableProjectProjectsUploadGrant) IsSet() bool {
return v.isSet
}
func (v *NullableProjectProjectsUploadGrant) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableProjectProjectsUploadGrant(val *ProjectProjectsUploadGrant) *NullableProjectProjectsUploadGrant {
return &NullableProjectProjectsUploadGrant{value: val, isSet: true}
}
func (v NullableProjectProjectsUploadGrant) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableProjectProjectsUploadGrant) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}