/*
 * 3DS OUTSCALE API
 *
 * Welcome to the OUTSCALE API documentation.<br /> The OUTSCALE API enables you to manage your resources in the OUTSCALE Cloud. This documentation describes the different actions available along with code examples.<br /><br /> Throttling: To protect against overloads, the number of identical requests allowed in a given time period is limited.<br /> Brute force: To protect against brute force attacks, the number of failed authentication attempts in a given time period is limited.<br /><br /> Note that the OUTSCALE Cloud is compatible with Amazon Web Services (AWS) APIs, but there are [differences in resource names](https://docs.outscale.com/en/userguide/About-the-APIs.html) between AWS and the OUTSCALE API.<br /> You can also manage your resources using the [Cockpit](https://docs.outscale.com/en/userguide/About-Cockpit.html) web interface.<br /><br /> An OpenAPI description of this API is also available for download: <button>[GitHub repository](https://github.com/outscale/osc-api)</button><br /> # Authentication Schemes ### Access Key/Secret Key The main way to authenticate your requests to the OUTSCALE API is to use an access key and a secret key.<br /> The mechanism behind this is based on AWS Signature Version 4, whose technical implementation details are described in [Signature of API Requests](https://docs.outscale.com/en/userguide/Signature-of-API-Requests.html).<br /><br /> In practice, the way to specify your access key and secret key depends on the tool or SDK you want to use to interact with the API.<br />  > For example, if you use OSC CLI: > 1. You need to create an **~/.osc/config.json** file to specify your access key, secret key, and the Region of your account. > 2. You then specify the `--profile` option when executing OSC CLI commands. > > For more information, see [Installing and Configuring OSC CLI](https://docs.outscale.com/en/userguide/Installing-and-Configuring-OSC-CLI.html).  See the code samples in each section of this documentation for specific examples in different programming languages.<br /> For more information about access keys, see [About Access Keys](https://docs.outscale.com/en/userguide/About-Access-Keys.html).  > If you try to sign requests with an invalid access key four times in a row, further authentication attempts will be prevented for 1 minute. This lockout time increases 1 minute every four failed attempts, for up to 10 minutes.  ### Login/Password For certain API actions, you can also use basic authentication with the login (email address) and password of your OUTSCALE account.<br /> This is useful only in special circumstances, for example if you do not know your access key/secret key and want to retrieve them programmatically.<br /> In most cases, however, you can use the Cockpit web interface to retrieve them.<br />  > For example, if you use OSC CLI: > 1. You need to create an **~/.osc/config.json** file to specify the Region of your account, but you leave the access key value and secret key value empty (`&quot;&quot;`). > 2. You then specify the `--profile`, `--authentication-method`, `--login`, and `--password` options when executing OSC CLI commands.  See the code samples in each section of this documentation for specific examples in different programming languages.  > If you try to sign requests with an invalid password four times in a row, further authentication attempts will be prevented for 1 minute. This lockout time increases 1 minute every four failed attempts, for up to 10 minutes.  ### No Authentication A few API actions do not require any authentication. They are indicated as such in this documentation.<br /> ### Other Security Mechanisms In parallel with the authentication schemes, you can add other security mechanisms to your OUTSCALE account, for example to restrict API requests by IP or other criteria.<br /> For more information, see [Managing Your API Accesses](https://docs.outscale.com/en/userguide/Managing-Your-API-Accesses.html). # Pagination Tutorial You can learn more about the pagination methods for read calls in the dedicated [pagination tutorial](https://docs.outscale.com/en/userguide/Tutorial-Paginating-an-API-Request.html). # Error Codes Reference You can learn more about errors returned by the API in the dedicated [errors page](api-errors.html).
 *
 * API version: 1.41.0
 * Contact: support@outscale.com
 */

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

package osc

import (
	"encoding/json"
)

// DeleteSecurityGroupRuleRequest struct for DeleteSecurityGroupRuleRequest
type DeleteSecurityGroupRuleRequest struct {
	// If true, checks whether you have the required permissions to perform the action.
	DryRun *bool `json:"DryRun,omitempty"`
	// The direction of the flow: `Inbound` or `Outbound`. You can specify `Outbound` for Nets only.
	Flow string `json:"Flow"`
	// The beginning of the port range for the TCP and UDP protocols, or an ICMP type number.
	FromPortRange *int32 `json:"FromPortRange,omitempty"`
	// The IP protocol name (`tcp`, `udp`, `icmp`, or `-1` for all protocols). By default, `-1`. In a Net, this can also be an IP protocol number. For more information, see the [IANA.org website](https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml).
	IpProtocol *string `json:"IpProtocol,omitempty"`
	// The IP range for the security group rule, in CIDR notation (for example, `10.0.0.0/16`).
	IpRange *string `json:"IpRange,omitempty"`
	// One or more rules you want to delete from the security group.
	Rules *[]SecurityGroupRule `json:"Rules,omitempty"`
	// The OUTSCALE account ID of the owner of the security group you want to delete a rule from.
	SecurityGroupAccountIdToUnlink *string `json:"SecurityGroupAccountIdToUnlink,omitempty"`
	// The ID of the security group you want to delete a rule from.
	SecurityGroupId string `json:"SecurityGroupId"`
	// The ID of the source security group. If you are in the Public Cloud, you can also specify the name of the source security group.
	SecurityGroupNameToUnlink *string `json:"SecurityGroupNameToUnlink,omitempty"`
	// The end of the port range for the TCP and UDP protocols, or an ICMP code number.
	ToPortRange *int32 `json:"ToPortRange,omitempty"`
}

// NewDeleteSecurityGroupRuleRequest instantiates a new DeleteSecurityGroupRuleRequest 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 NewDeleteSecurityGroupRuleRequest(flow string, securityGroupId string) *DeleteSecurityGroupRuleRequest {
	this := DeleteSecurityGroupRuleRequest{}
	this.Flow = flow
	this.SecurityGroupId = securityGroupId
	return &this
}

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

// GetDryRun returns the DryRun field value if set, zero value otherwise.
func (o *DeleteSecurityGroupRuleRequest) GetDryRun() bool {
	if o == nil || o.DryRun == nil {
		var ret bool
		return ret
	}
	return *o.DryRun
}

// GetDryRunOk returns a tuple with the DryRun field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeleteSecurityGroupRuleRequest) GetDryRunOk() (*bool, bool) {
	if o == nil || o.DryRun == nil {
		return nil, false
	}
	return o.DryRun, true
}

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

	return false
}

// SetDryRun gets a reference to the given bool and assigns it to the DryRun field.
func (o *DeleteSecurityGroupRuleRequest) SetDryRun(v bool) {
	o.DryRun = &v
}

// GetFlow returns the Flow field value
func (o *DeleteSecurityGroupRuleRequest) GetFlow() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Flow
}

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

// SetFlow sets field value
func (o *DeleteSecurityGroupRuleRequest) SetFlow(v string) {
	o.Flow = v
}

// GetFromPortRange returns the FromPortRange field value if set, zero value otherwise.
func (o *DeleteSecurityGroupRuleRequest) GetFromPortRange() int32 {
	if o == nil || o.FromPortRange == nil {
		var ret int32
		return ret
	}
	return *o.FromPortRange
}

// GetFromPortRangeOk returns a tuple with the FromPortRange field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeleteSecurityGroupRuleRequest) GetFromPortRangeOk() (*int32, bool) {
	if o == nil || o.FromPortRange == nil {
		return nil, false
	}
	return o.FromPortRange, true
}

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

	return false
}

// SetFromPortRange gets a reference to the given int32 and assigns it to the FromPortRange field.
func (o *DeleteSecurityGroupRuleRequest) SetFromPortRange(v int32) {
	o.FromPortRange = &v
}

// GetIpProtocol returns the IpProtocol field value if set, zero value otherwise.
func (o *DeleteSecurityGroupRuleRequest) GetIpProtocol() string {
	if o == nil || o.IpProtocol == nil {
		var ret string
		return ret
	}
	return *o.IpProtocol
}

// GetIpProtocolOk returns a tuple with the IpProtocol field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeleteSecurityGroupRuleRequest) GetIpProtocolOk() (*string, bool) {
	if o == nil || o.IpProtocol == nil {
		return nil, false
	}
	return o.IpProtocol, true
}

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

	return false
}

// SetIpProtocol gets a reference to the given string and assigns it to the IpProtocol field.
func (o *DeleteSecurityGroupRuleRequest) SetIpProtocol(v string) {
	o.IpProtocol = &v
}

// GetIpRange returns the IpRange field value if set, zero value otherwise.
func (o *DeleteSecurityGroupRuleRequest) GetIpRange() string {
	if o == nil || o.IpRange == nil {
		var ret string
		return ret
	}
	return *o.IpRange
}

// GetIpRangeOk returns a tuple with the IpRange field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeleteSecurityGroupRuleRequest) GetIpRangeOk() (*string, bool) {
	if o == nil || o.IpRange == nil {
		return nil, false
	}
	return o.IpRange, true
}

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

	return false
}

// SetIpRange gets a reference to the given string and assigns it to the IpRange field.
func (o *DeleteSecurityGroupRuleRequest) SetIpRange(v string) {
	o.IpRange = &v
}

// GetRules returns the Rules field value if set, zero value otherwise.
func (o *DeleteSecurityGroupRuleRequest) GetRules() []SecurityGroupRule {
	if o == nil || o.Rules == nil {
		var ret []SecurityGroupRule
		return ret
	}
	return *o.Rules
}

// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeleteSecurityGroupRuleRequest) GetRulesOk() (*[]SecurityGroupRule, bool) {
	if o == nil || o.Rules == nil {
		return nil, false
	}
	return o.Rules, true
}

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

	return false
}

// SetRules gets a reference to the given []SecurityGroupRule and assigns it to the Rules field.
func (o *DeleteSecurityGroupRuleRequest) SetRules(v []SecurityGroupRule) {
	o.Rules = &v
}

// GetSecurityGroupAccountIdToUnlink returns the SecurityGroupAccountIdToUnlink field value if set, zero value otherwise.
func (o *DeleteSecurityGroupRuleRequest) GetSecurityGroupAccountIdToUnlink() string {
	if o == nil || o.SecurityGroupAccountIdToUnlink == nil {
		var ret string
		return ret
	}
	return *o.SecurityGroupAccountIdToUnlink
}

// GetSecurityGroupAccountIdToUnlinkOk returns a tuple with the SecurityGroupAccountIdToUnlink field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeleteSecurityGroupRuleRequest) GetSecurityGroupAccountIdToUnlinkOk() (*string, bool) {
	if o == nil || o.SecurityGroupAccountIdToUnlink == nil {
		return nil, false
	}
	return o.SecurityGroupAccountIdToUnlink, true
}

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

	return false
}

// SetSecurityGroupAccountIdToUnlink gets a reference to the given string and assigns it to the SecurityGroupAccountIdToUnlink field.
func (o *DeleteSecurityGroupRuleRequest) SetSecurityGroupAccountIdToUnlink(v string) {
	o.SecurityGroupAccountIdToUnlink = &v
}

// GetSecurityGroupId returns the SecurityGroupId field value
func (o *DeleteSecurityGroupRuleRequest) GetSecurityGroupId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.SecurityGroupId
}

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

// SetSecurityGroupId sets field value
func (o *DeleteSecurityGroupRuleRequest) SetSecurityGroupId(v string) {
	o.SecurityGroupId = v
}

// GetSecurityGroupNameToUnlink returns the SecurityGroupNameToUnlink field value if set, zero value otherwise.
func (o *DeleteSecurityGroupRuleRequest) GetSecurityGroupNameToUnlink() string {
	if o == nil || o.SecurityGroupNameToUnlink == nil {
		var ret string
		return ret
	}
	return *o.SecurityGroupNameToUnlink
}

// GetSecurityGroupNameToUnlinkOk returns a tuple with the SecurityGroupNameToUnlink field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeleteSecurityGroupRuleRequest) GetSecurityGroupNameToUnlinkOk() (*string, bool) {
	if o == nil || o.SecurityGroupNameToUnlink == nil {
		return nil, false
	}
	return o.SecurityGroupNameToUnlink, true
}

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

	return false
}

// SetSecurityGroupNameToUnlink gets a reference to the given string and assigns it to the SecurityGroupNameToUnlink field.
func (o *DeleteSecurityGroupRuleRequest) SetSecurityGroupNameToUnlink(v string) {
	o.SecurityGroupNameToUnlink = &v
}

// GetToPortRange returns the ToPortRange field value if set, zero value otherwise.
func (o *DeleteSecurityGroupRuleRequest) GetToPortRange() int32 {
	if o == nil || o.ToPortRange == nil {
		var ret int32
		return ret
	}
	return *o.ToPortRange
}

// GetToPortRangeOk returns a tuple with the ToPortRange field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeleteSecurityGroupRuleRequest) GetToPortRangeOk() (*int32, bool) {
	if o == nil || o.ToPortRange == nil {
		return nil, false
	}
	return o.ToPortRange, true
}

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

	return false
}

// SetToPortRange gets a reference to the given int32 and assigns it to the ToPortRange field.
func (o *DeleteSecurityGroupRuleRequest) SetToPortRange(v int32) {
	o.ToPortRange = &v
}

func (o DeleteSecurityGroupRuleRequest) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.DryRun != nil {
		toSerialize["DryRun"] = o.DryRun
	}
	if true {
		toSerialize["Flow"] = o.Flow
	}
	if o.FromPortRange != nil {
		toSerialize["FromPortRange"] = o.FromPortRange
	}
	if o.IpProtocol != nil {
		toSerialize["IpProtocol"] = o.IpProtocol
	}
	if o.IpRange != nil {
		toSerialize["IpRange"] = o.IpRange
	}
	if o.Rules != nil {
		toSerialize["Rules"] = o.Rules
	}
	if o.SecurityGroupAccountIdToUnlink != nil {
		toSerialize["SecurityGroupAccountIdToUnlink"] = o.SecurityGroupAccountIdToUnlink
	}
	if true {
		toSerialize["SecurityGroupId"] = o.SecurityGroupId
	}
	if o.SecurityGroupNameToUnlink != nil {
		toSerialize["SecurityGroupNameToUnlink"] = o.SecurityGroupNameToUnlink
	}
	if o.ToPortRange != nil {
		toSerialize["ToPortRange"] = o.ToPortRange
	}
	return json.Marshal(toSerialize)
}

type NullableDeleteSecurityGroupRuleRequest struct {
	value *DeleteSecurityGroupRuleRequest
	isSet bool
}

func (v NullableDeleteSecurityGroupRuleRequest) Get() *DeleteSecurityGroupRuleRequest {
	return v.value
}

func (v *NullableDeleteSecurityGroupRuleRequest) Set(val *DeleteSecurityGroupRuleRequest) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDeleteSecurityGroupRuleRequest(val *DeleteSecurityGroupRuleRequest) *NullableDeleteSecurityGroupRuleRequest {
	return &NullableDeleteSecurityGroupRuleRequest{value: val, isSet: true}
}

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

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