Files
sdk/model_security_submit_req.go

206 lines
5.4 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 SecuritySubmitReq type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &SecuritySubmitReq{}
// SecuritySubmitReq struct for SecuritySubmitReq
type SecuritySubmitReq struct {
// Files is the batch to scan, at most 500 files and 8 MiB of content in total.
Files []SecurityScan `json:"files"`
// Project names the sub-scope the scan is filed under. It must be a slug; omit it and the caller's project header is used instead.
Project *string `json:"project,omitempty"`
AdditionalProperties map[string]interface{}
}
type _SecuritySubmitReq SecuritySubmitReq
// NewSecuritySubmitReq instantiates a new SecuritySubmitReq 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 NewSecuritySubmitReq(files []SecurityScan) *SecuritySubmitReq {
this := SecuritySubmitReq{}
this.Files = files
return &this
}
// NewSecuritySubmitReqWithDefaults instantiates a new SecuritySubmitReq 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 NewSecuritySubmitReqWithDefaults() *SecuritySubmitReq {
this := SecuritySubmitReq{}
return &this
}
// GetFiles returns the Files field value
func (o *SecuritySubmitReq) GetFiles() []SecurityScan {
if o == nil {
var ret []SecurityScan
return ret
}
return o.Files
}
// GetFilesOk returns a tuple with the Files field value
// and a boolean to check if the value has been set.
func (o *SecuritySubmitReq) GetFilesOk() ([]SecurityScan, bool) {
if o == nil {
return nil, false
}
return o.Files, true
}
// SetFiles sets field value
func (o *SecuritySubmitReq) SetFiles(v []SecurityScan) {
o.Files = v
}
// GetProject returns the Project field value if set, zero value otherwise.
func (o *SecuritySubmitReq) GetProject() string {
if o == nil || IsNil(o.Project) {
var ret string
return ret
}
return *o.Project
}
// GetProjectOk returns a tuple with the Project field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *SecuritySubmitReq) GetProjectOk() (*string, bool) {
if o == nil || IsNil(o.Project) {
return nil, false
}
return o.Project, true
}
// HasProject returns a boolean if a field has been set.
func (o *SecuritySubmitReq) HasProject() bool {
if o != nil && !IsNil(o.Project) {
return true
}
return false
}
// SetProject gets a reference to the given string and assigns it to the Project field.
func (o *SecuritySubmitReq) SetProject(v string) {
o.Project = &v
}
func (o SecuritySubmitReq) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o SecuritySubmitReq) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["files"] = o.Files
if !IsNil(o.Project) {
toSerialize["project"] = o.Project
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *SecuritySubmitReq) 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{
"files",
}
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)
}
}
varSecuritySubmitReq := _SecuritySubmitReq{}
err = json.Unmarshal(data, &varSecuritySubmitReq)
if err != nil {
return err
}
*o = SecuritySubmitReq(varSecuritySubmitReq)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "files")
delete(additionalProperties, "project")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableSecuritySubmitReq struct {
value *SecuritySubmitReq
isSet bool
}
func (v NullableSecuritySubmitReq) Get() *SecuritySubmitReq {
return v.value
}
func (v *NullableSecuritySubmitReq) Set(val *SecuritySubmitReq) {
v.value = val
v.isSet = true
}
func (v NullableSecuritySubmitReq) IsSet() bool {
return v.isSet
}
func (v *NullableSecuritySubmitReq) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableSecuritySubmitReq(val *SecuritySubmitReq) *NullableSecuritySubmitReq {
return &NullableSecuritySubmitReq{value: val, isSet: true}
}
func (v NullableSecuritySubmitReq) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableSecuritySubmitReq) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}