debian-forge-composer/vendor/github.com/osbuild/pulp-client/pulpclient/model_role.go
Achilleas Koutsou bc6c2fb6af upload: define new pulp uploader
Define a basic client struct to pull in the pulp-client library.
2023-10-18 21:14:46 +02:00

221 lines
5.1 KiB
Go

/*
Pulp 3 API
Fetch, Upload, Organize, and Distribute Software Packages
API version: v3
Contact: pulp-list@redhat.com
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package pulpclient
import (
"encoding/json"
)
// checks if the Role type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Role{}
// Role Serializer for Role.
type Role struct {
// The name of this role.
Name string `json:"name"`
// An optional description.
Description NullableString `json:"description,omitempty"`
// List of permissions defining the role.
Permissions []string `json:"permissions"`
AdditionalProperties map[string]interface{}
}
type _Role Role
// NewRole instantiates a new Role 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 NewRole(name string, permissions []string) *Role {
this := Role{}
this.Name = name
this.Permissions = permissions
return &this
}
// NewRoleWithDefaults instantiates a new Role 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 NewRoleWithDefaults() *Role {
this := Role{}
return &this
}
// GetName returns the Name field value
func (o *Role) 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 *Role) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *Role) SetName(v string) {
o.Name = v
}
// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Role) GetDescription() string {
if o == nil || IsNil(o.Description.Get()) {
var ret string
return ret
}
return *o.Description.Get()
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// 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 *Role) GetDescriptionOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.Description.Get(), o.Description.IsSet()
}
// HasDescription returns a boolean if a field has been set.
func (o *Role) HasDescription() bool {
if o != nil && o.Description.IsSet() {
return true
}
return false
}
// SetDescription gets a reference to the given NullableString and assigns it to the Description field.
func (o *Role) SetDescription(v string) {
o.Description.Set(&v)
}
// SetDescriptionNil sets the value for Description to be an explicit nil
func (o *Role) SetDescriptionNil() {
o.Description.Set(nil)
}
// UnsetDescription ensures that no value is present for Description, not even an explicit nil
func (o *Role) UnsetDescription() {
o.Description.Unset()
}
// GetPermissions returns the Permissions field value
func (o *Role) 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 *Role) GetPermissionsOk() ([]string, bool) {
if o == nil {
return nil, false
}
return o.Permissions, true
}
// SetPermissions sets field value
func (o *Role) SetPermissions(v []string) {
o.Permissions = v
}
func (o Role) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Role) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["name"] = o.Name
if o.Description.IsSet() {
toSerialize["description"] = o.Description.Get()
}
toSerialize["permissions"] = o.Permissions
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *Role) UnmarshalJSON(bytes []byte) (err error) {
varRole := _Role{}
if err = json.Unmarshal(bytes, &varRole); err == nil {
*o = Role(varRole)
}
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
delete(additionalProperties, "name")
delete(additionalProperties, "description")
delete(additionalProperties, "permissions")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableRole struct {
value *Role
isSet bool
}
func (v NullableRole) Get() *Role {
return v.value
}
func (v *NullableRole) Set(val *Role) {
v.value = val
v.isSet = true
}
func (v NullableRole) IsSet() bool {
return v.isSet
}
func (v *NullableRole) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableRole(val *Role) *NullableRole {
return &NullableRole{value: val, isSet: true}
}
func (v NullableRole) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableRole) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}