/*
 * IONOS Object Storage API for contract-owned buckets
 *
 * ## Overview The IONOS Object Storage API for contract-owned buckets is a REST-based API that allows developers and applications to interact directly with IONOS' scalable storage solution, leveraging the S3 protocol for object storage operations. Its design ensures seamless compatibility with existing tools and libraries tailored for S3 systems.  ### API References - [S3 API Reference for contract-owned buckets](https://api.ionos.com/docs/s3-contract-owned-buckets/v2/) ### User documentation [IONOS Object Storage User Guide](https://docs.ionos.com/cloud/managed-services/s3-object-storage) * [Documentation on user-owned and contract-owned buckets](https://docs.ionos.com/cloud/managed-services/s3-object-storage/concepts/buckets) * [Documentation on S3 API Compatibility](https://docs.ionos.com/cloud/managed-services/s3-object-storage/concepts/s3-api-compatibility) * [S3 Tools](https://docs.ionos.com/cloud/managed-services/s3-object-storage/s3-tools)  ## Endpoints for contract-owned buckets | Location | Region Name | Bucket Type | Endpoint | | --- | --- | --- | --- | | **Berlin, Germany** | **eu-central-3** | Contract-owned | `https://s3.eu-central-3.ionoscloud.com` |  ## Changelog - 30.05.2024 Initial version
 *
 * API version: 2.0.2
 * Contact: support@cloud.ionos.com
 */

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

package ionoscloud

import (
	"encoding/json"
)

import "encoding/xml"

// BucketPolicyStatement struct for BucketPolicyStatement
type BucketPolicyStatement struct {
	XMLName xml.Name `xml:"BucketPolicyStatement"`
	// Custom string identifying the statement.
	Sid *string `json:"Sid,omitempty" xml:"Sid"`
	// The array of allowed or denied actions.   IONOS Object Storage supports the use of a wildcard in your Action configuration (`\"Action\":[\"s3:*\"]`). When an Action wildcard is used together with an object-level Resource element (`\"arn:aws:s3:::<bucketName>/_*\"` or `\"arn:aws:s3:::<bucketName>/<objectName>\"`), the wildcard denotes all supported Object actions. When an Action wildcard is used together with bucket-level Resource element (`\"arn:aws:s3:::<bucketName>\"`), the wildcard denotes all the bucket actions and bucket subresource actions that IONOS Object Storage supports.
	Action *[]string `json:"Action" xml:"Action"`
	// Specify the outcome when the user requests a particular action.
	Effect *string `json:"Effect" xml:"Effect"`
	// The bucket or object that the policy applies to.   Must be one of the following: - `\"arn:aws:s3:::<bucketName>\"` - For bucket actions (such as `s3:ListBucket`) and bucket subresource actions (such as `s3:GetBucketAcl`). - `\"arn:aws:s3:::<bucketName>/_*\"` or `\"arn:aws:s3:::<bucketName>/<objectName>\"` - For object actions (such as `s3:PutObject`).
	Resource  *[]string              `json:"Resource" xml:"Resource"`
	Condition *BucketPolicyCondition `json:"Condition,omitempty" xml:"Condition"`
	Principal *Principal             `json:"Principal,omitempty" xml:"Principal"`
}

// NewBucketPolicyStatement instantiates a new BucketPolicyStatement 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 NewBucketPolicyStatement(action []string, effect string, resource []string) *BucketPolicyStatement {
	this := BucketPolicyStatement{}

	this.Action = &action
	this.Effect = &effect
	this.Resource = &resource

	return &this
}

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

// GetSid returns the Sid field value
// If the value is explicit nil, the zero value for string will be returned
func (o *BucketPolicyStatement) GetSid() *string {
	if o == nil {
		return nil
	}

	return o.Sid

}

// GetSidOk returns a tuple with the Sid field value
// 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 *BucketPolicyStatement) GetSidOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Sid, true
}

// SetSid sets field value
func (o *BucketPolicyStatement) SetSid(v string) {

	o.Sid = &v

}

// HasSid returns a boolean if a field has been set.
func (o *BucketPolicyStatement) HasSid() bool {
	if o != nil && o.Sid != nil {
		return true
	}

	return false
}

// GetAction returns the Action field value
// If the value is explicit nil, the zero value for []string will be returned
func (o *BucketPolicyStatement) GetAction() *[]string {
	if o == nil {
		return nil
	}

	return o.Action

}

// GetActionOk returns a tuple with the Action field value
// 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 *BucketPolicyStatement) GetActionOk() (*[]string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Action, true
}

// SetAction sets field value
func (o *BucketPolicyStatement) SetAction(v []string) {

	o.Action = &v

}

// HasAction returns a boolean if a field has been set.
func (o *BucketPolicyStatement) HasAction() bool {
	if o != nil && o.Action != nil {
		return true
	}

	return false
}

// GetEffect returns the Effect field value
// If the value is explicit nil, the zero value for string will be returned
func (o *BucketPolicyStatement) GetEffect() *string {
	if o == nil {
		return nil
	}

	return o.Effect

}

// GetEffectOk returns a tuple with the Effect field value
// 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 *BucketPolicyStatement) GetEffectOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Effect, true
}

// SetEffect sets field value
func (o *BucketPolicyStatement) SetEffect(v string) {

	o.Effect = &v

}

// HasEffect returns a boolean if a field has been set.
func (o *BucketPolicyStatement) HasEffect() bool {
	if o != nil && o.Effect != nil {
		return true
	}

	return false
}

// GetResource returns the Resource field value
// If the value is explicit nil, the zero value for []string will be returned
func (o *BucketPolicyStatement) GetResource() *[]string {
	if o == nil {
		return nil
	}

	return o.Resource

}

// GetResourceOk returns a tuple with the Resource field value
// 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 *BucketPolicyStatement) GetResourceOk() (*[]string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Resource, true
}

// SetResource sets field value
func (o *BucketPolicyStatement) SetResource(v []string) {

	o.Resource = &v

}

// HasResource returns a boolean if a field has been set.
func (o *BucketPolicyStatement) HasResource() bool {
	if o != nil && o.Resource != nil {
		return true
	}

	return false
}

// GetCondition returns the Condition field value
// If the value is explicit nil, the zero value for BucketPolicyCondition will be returned
func (o *BucketPolicyStatement) GetCondition() *BucketPolicyCondition {
	if o == nil {
		return nil
	}

	return o.Condition

}

// GetConditionOk returns a tuple with the Condition field value
// 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 *BucketPolicyStatement) GetConditionOk() (*BucketPolicyCondition, bool) {
	if o == nil {
		return nil, false
	}

	return o.Condition, true
}

// SetCondition sets field value
func (o *BucketPolicyStatement) SetCondition(v BucketPolicyCondition) {

	o.Condition = &v

}

// HasCondition returns a boolean if a field has been set.
func (o *BucketPolicyStatement) HasCondition() bool {
	if o != nil && o.Condition != nil {
		return true
	}

	return false
}

// GetPrincipal returns the Principal field value
// If the value is explicit nil, the zero value for Principal will be returned
func (o *BucketPolicyStatement) GetPrincipal() *Principal {
	if o == nil {
		return nil
	}

	return o.Principal

}

// GetPrincipalOk returns a tuple with the Principal field value
// 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 *BucketPolicyStatement) GetPrincipalOk() (*Principal, bool) {
	if o == nil {
		return nil, false
	}

	return o.Principal, true
}

// SetPrincipal sets field value
func (o *BucketPolicyStatement) SetPrincipal(v Principal) {

	o.Principal = &v

}

// HasPrincipal returns a boolean if a field has been set.
func (o *BucketPolicyStatement) HasPrincipal() bool {
	if o != nil && o.Principal != nil {
		return true
	}

	return false
}

func (o BucketPolicyStatement) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.Sid != nil {
		toSerialize["Sid"] = o.Sid
	}

	if o.Action != nil {
		toSerialize["Action"] = o.Action
	}

	if o.Effect != nil {
		toSerialize["Effect"] = o.Effect
	}

	if o.Resource != nil {
		toSerialize["Resource"] = o.Resource
	}

	if o.Condition != nil {
		toSerialize["Condition"] = o.Condition
	}

	if o.Principal != nil {
		toSerialize["Principal"] = o.Principal
	}

	return json.Marshal(toSerialize)
}

type NullableBucketPolicyStatement struct {
	value *BucketPolicyStatement
	isSet bool
}

func (v NullableBucketPolicyStatement) Get() *BucketPolicyStatement {
	return v.value
}

func (v *NullableBucketPolicyStatement) Set(val *BucketPolicyStatement) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableBucketPolicyStatement(val *BucketPolicyStatement) *NullableBucketPolicyStatement {
	return &NullableBucketPolicyStatement{value: val, isSet: true}
}

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

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