/*
Mender API

Combined API specification for the features of the different Mender backend services, suitable for code generation applications 

API version: 1
Contact: support@mender.io
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package client

import (
	"encoding/json"
	"fmt"
)

// checks if the AWSCredentialsAws type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AWSCredentialsAws{}

// AWSCredentialsAws struct for AWSCredentialsAws
type AWSCredentialsAws struct {
	AccessKeyId string `json:"access_key_id"`
	SecretAccessKey string `json:"secret_access_key"`
	Region string `json:"region"`
	DevicePolicyName string `json:"device_policy_name"`
	AdditionalProperties map[string]interface{}
}

type _AWSCredentialsAws AWSCredentialsAws

// NewAWSCredentialsAws instantiates a new AWSCredentialsAws 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 NewAWSCredentialsAws(accessKeyId string, secretAccessKey string, region string, devicePolicyName string) *AWSCredentialsAws {
	this := AWSCredentialsAws{}
	this.AccessKeyId = accessKeyId
	this.SecretAccessKey = secretAccessKey
	this.Region = region
	this.DevicePolicyName = devicePolicyName
	return &this
}

// NewAWSCredentialsAwsWithDefaults instantiates a new AWSCredentialsAws 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 NewAWSCredentialsAwsWithDefaults() *AWSCredentialsAws {
	this := AWSCredentialsAws{}
	return &this
}

// GetAccessKeyId returns the AccessKeyId field value
func (o *AWSCredentialsAws) GetAccessKeyId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.AccessKeyId
}

// GetAccessKeyIdOk returns a tuple with the AccessKeyId field value
// and a boolean to check if the value has been set.
func (o *AWSCredentialsAws) GetAccessKeyIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.AccessKeyId, true
}

// SetAccessKeyId sets field value
func (o *AWSCredentialsAws) SetAccessKeyId(v string) {
	o.AccessKeyId = v
}

// GetSecretAccessKey returns the SecretAccessKey field value
func (o *AWSCredentialsAws) GetSecretAccessKey() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.SecretAccessKey
}

// GetSecretAccessKeyOk returns a tuple with the SecretAccessKey field value
// and a boolean to check if the value has been set.
func (o *AWSCredentialsAws) GetSecretAccessKeyOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.SecretAccessKey, true
}

// SetSecretAccessKey sets field value
func (o *AWSCredentialsAws) SetSecretAccessKey(v string) {
	o.SecretAccessKey = v
}

// GetRegion returns the Region field value
func (o *AWSCredentialsAws) GetRegion() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Region
}

// GetRegionOk returns a tuple with the Region field value
// and a boolean to check if the value has been set.
func (o *AWSCredentialsAws) GetRegionOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Region, true
}

// SetRegion sets field value
func (o *AWSCredentialsAws) SetRegion(v string) {
	o.Region = v
}

// GetDevicePolicyName returns the DevicePolicyName field value
func (o *AWSCredentialsAws) GetDevicePolicyName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.DevicePolicyName
}

// GetDevicePolicyNameOk returns a tuple with the DevicePolicyName field value
// and a boolean to check if the value has been set.
func (o *AWSCredentialsAws) GetDevicePolicyNameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.DevicePolicyName, true
}

// SetDevicePolicyName sets field value
func (o *AWSCredentialsAws) SetDevicePolicyName(v string) {
	o.DevicePolicyName = v
}

func (o AWSCredentialsAws) MarshalJSON() ([]byte, error) {
	toSerialize,err := o.ToMap()
	if err != nil {
		return []byte{}, err
	}
	return json.Marshal(toSerialize)
}

func (o AWSCredentialsAws) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["access_key_id"] = o.AccessKeyId
	toSerialize["secret_access_key"] = o.SecretAccessKey
	toSerialize["region"] = o.Region
	toSerialize["device_policy_name"] = o.DevicePolicyName

	for key, value := range o.AdditionalProperties {
		toSerialize[key] = value
	}

	return toSerialize, nil
}

func (o *AWSCredentialsAws) 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{
		"access_key_id",
		"secret_access_key",
		"region",
		"device_policy_name",
	}

	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)
		}
	}

	varAWSCredentialsAws := _AWSCredentialsAws{}

	err = json.Unmarshal(data, &varAWSCredentialsAws)

	if err != nil {
		return err
	}

	*o = AWSCredentialsAws(varAWSCredentialsAws)

	additionalProperties := make(map[string]interface{})

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "access_key_id")
		delete(additionalProperties, "secret_access_key")
		delete(additionalProperties, "region")
		delete(additionalProperties, "device_policy_name")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableAWSCredentialsAws struct {
	value *AWSCredentialsAws
	isSet bool
}

func (v NullableAWSCredentialsAws) Get() *AWSCredentialsAws {
	return v.value
}

func (v *NullableAWSCredentialsAws) Set(val *AWSCredentialsAws) {
	v.value = val
	v.isSet = true
}

func (v NullableAWSCredentialsAws) IsSet() bool {
	return v.isSet
}

func (v *NullableAWSCredentialsAws) Unset() {
	v.value = nil
	v.isSet = false
}

func NewNullableAWSCredentialsAws(val *AWSCredentialsAws) *NullableAWSCredentialsAws {
	return &NullableAWSCredentialsAws{value: val, isSet: true}
}

func (v NullableAWSCredentialsAws) MarshalJSON() ([]byte, error) {
	return json.Marshal(v.value)
}

func (v *NullableAWSCredentialsAws) UnmarshalJSON(src []byte) error {
	v.isSet = true
	return json.Unmarshal(src, &v.value)
}


