// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
using Pulumi;

namespace PiersKarsenbarg.Nutanix
{
    /// <summary>
    /// Provides Nutanix resource to create Policy Based Routing inside VPCs.
    /// 
    /// ## Example Usage
    /// ### pbr creation with vpc name with any source or destination or protocol with permit action
    /// 
    /// ```csharp
    /// using Pulumi;
    /// using Nutanix = PiersKarsenbarg.Nutanix;
    /// 
    /// class MyStack : Stack
    /// {
    ///     public MyStack()
    ///     {
    ///         var pbr = new Nutanix.Pbr("pbr", new Nutanix.PbrArgs
    ///         {
    ///             Action = "PERMIT",
    ///             Destination = new Nutanix.Inputs.PbrDestinationArgs
    ///             {
    ///                 AddressType = "ALL",
    ///             },
    ///             Priority = 123,
    ///             ProtocolType = "ALL",
    ///             Source = new Nutanix.Inputs.PbrSourceArgs
    ///             {
    ///                 AddressType = "ALL",
    ///             },
    ///             VpcName = "test123",
    ///         });
    ///     }
    /// 
    /// }
    /// ```
    /// ## source
    /// 
    /// source address of an IP packet. This could be either an ip prefix or an address_type .
    /// 
    /// * `address` - (Optional) address type of source. Should be one of {INTERNET, ALL}.
    /// * `subnet_ip` - (Optional) IP subnet provided as an address.
    /// * `prefix_length` - (Optional) prefix length of provided subnet.
    /// 
    /// ## destination
    /// 
    /// destination address of an IP packet. This could be either an ip prefix or an address_type .
    /// 
    /// * `address` - (Optional) address type of source. Should be one of {INTERNET, ALL}.
    /// * `subnet_ip` - (Optional) IP subnet provided as an address.
    /// * `prefix_length` - (Optional) prefix length of provided subnet.
    /// 
    /// ## protocol_parameters
    /// 
    /// Routing policy IP protocol parameters
    /// 
    /// * `tcp` - (Optional) TCP parameters in routing policy
    /// * `udp` - (Optional) UDP parameters in routing policy
    /// * `icmp` - (Optional) ICMP parameters in routing policy.
    /// * `protocol_number` - (Optional) Protocol number in routing policy
    /// 
    /// ## tcp, udp
    /// 
    /// * `source_port_range` - (Required) Range of TCP/UDP ports.
    /// * `destination_port_range` - (Required) Range of TCP/UDP ports.
    /// 
    /// ## source_port_range, destination_port_range
    /// 
    /// * `start_port` - (Required) start port number
    /// * `end_port` - (Required) end port number
    /// </summary>
    [NutanixResourceType("nutanix:index/pbr:Pbr")]
    public partial class Pbr : Pulumi.CustomResource
    {
        /// <summary>
        /// Routing policy action. Must be one of {DENY, PERMIT, REROUTE} .
        /// </summary>
        [Output("action")]
        public Output<string> Action { get; private set; } = null!;

        /// <summary>
        /// The version of the API.
        /// </summary>
        [Output("apiVersion")]
        public Output<string> ApiVersion { get; private set; } = null!;

        [Output("destination")]
        public Output<Outputs.PbrDestination> Destination { get; private set; } = null!;

        /// <summary>
        /// Additionally create Policy in reverse direction. Should be used with {TCP, UDP with start and end port ranges and ICMP with icmp code and type}. Supported with 2022.x.
        /// </summary>
        [Output("isBidirectional")]
        public Output<bool> IsBidirectional { get; private set; } = null!;

        /// <summary>
        /// The routing policies kind metadata.
        /// </summary>
        [Output("metadata")]
        public Output<ImmutableDictionary<string, string>> Metadata { get; private set; } = null!;

        /// <summary>
        /// name of policy
        /// </summary>
        [Output("name")]
        public Output<string> Name { get; private set; } = null!;

        /// <summary>
        /// priority of policy
        /// </summary>
        [Output("priority")]
        public Output<int> Priority { get; private set; } = null!;

        [Output("protocolParameters")]
        public Output<Outputs.PbrProtocolParameters?> ProtocolParameters { get; private set; } = null!;

        /// <summary>
        /// Protocol type of policy based routing. Must be one of {TCP, UDP, ICMP, PROTOCOL_NUMBER, ALL} .
        /// </summary>
        [Output("protocolType")]
        public Output<string> ProtocolType { get; private set; } = null!;

        /// <summary>
        /// IP addresses of network services. This field is valid only when action is REROUTE.
        /// </summary>
        [Output("serviceIpLists")]
        public Output<ImmutableArray<string>> ServiceIpLists { get; private set; } = null!;

        [Output("source")]
        public Output<Outputs.PbrSource> Source { get; private set; } = null!;

        /// <summary>
        /// The reference to a vpc. Should not be used with {vpc_reference_uuid}
        /// </summary>
        [Output("vpcName")]
        public Output<string> VpcName { get; private set; } = null!;

        /// <summary>
        /// The reference to a vpc . Should not be used with {vpc_name} .
        /// </summary>
        [Output("vpcReferenceUuid")]
        public Output<string> VpcReferenceUuid { get; private set; } = null!;


        /// <summary>
        /// Create a Pbr resource with the given unique name, arguments, and options.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resource</param>
        /// <param name="args">The arguments used to populate this resource's properties</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public Pbr(string name, PbrArgs args, CustomResourceOptions? options = null)
            : base("nutanix:index/pbr:Pbr", name, args ?? new PbrArgs(), MakeResourceOptions(options, ""))
        {
        }

        private Pbr(string name, Input<string> id, PbrState? state = null, CustomResourceOptions? options = null)
            : base("nutanix:index/pbr:Pbr", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
                PluginDownloadURL = "https://github.com/pierskarsenbarg/pulumi-nutanix/releases/download/${VERSION}",
            };
            var merged = CustomResourceOptions.Merge(defaultOptions, options);
            // Override the ID if one was specified for consistency with other language SDKs.
            merged.Id = id ?? merged.Id;
            return merged;
        }
        /// <summary>
        /// Get an existing Pbr resource's state with the given name, ID, and optional extra
        /// properties used to qualify the lookup.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resulting resource.</param>
        /// <param name="id">The unique provider ID of the resource to lookup.</param>
        /// <param name="state">Any extra arguments used during the lookup.</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public static Pbr Get(string name, Input<string> id, PbrState? state = null, CustomResourceOptions? options = null)
        {
            return new Pbr(name, id, state, options);
        }
    }

    public sealed class PbrArgs : Pulumi.ResourceArgs
    {
        /// <summary>
        /// Routing policy action. Must be one of {DENY, PERMIT, REROUTE} .
        /// </summary>
        [Input("action", required: true)]
        public Input<string> Action { get; set; } = null!;

        /// <summary>
        /// The version of the API.
        /// </summary>
        [Input("apiVersion")]
        public Input<string>? ApiVersion { get; set; }

        [Input("destination", required: true)]
        public Input<Inputs.PbrDestinationArgs> Destination { get; set; } = null!;

        /// <summary>
        /// Additionally create Policy in reverse direction. Should be used with {TCP, UDP with start and end port ranges and ICMP with icmp code and type}. Supported with 2022.x.
        /// </summary>
        [Input("isBidirectional")]
        public Input<bool>? IsBidirectional { get; set; }

        /// <summary>
        /// name of policy
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

        /// <summary>
        /// priority of policy
        /// </summary>
        [Input("priority", required: true)]
        public Input<int> Priority { get; set; } = null!;

        [Input("protocolParameters")]
        public Input<Inputs.PbrProtocolParametersArgs>? ProtocolParameters { get; set; }

        /// <summary>
        /// Protocol type of policy based routing. Must be one of {TCP, UDP, ICMP, PROTOCOL_NUMBER, ALL} .
        /// </summary>
        [Input("protocolType", required: true)]
        public Input<string> ProtocolType { get; set; } = null!;

        [Input("serviceIpLists")]
        private InputList<string>? _serviceIpLists;

        /// <summary>
        /// IP addresses of network services. This field is valid only when action is REROUTE.
        /// </summary>
        public InputList<string> ServiceIpLists
        {
            get => _serviceIpLists ?? (_serviceIpLists = new InputList<string>());
            set => _serviceIpLists = value;
        }

        [Input("source", required: true)]
        public Input<Inputs.PbrSourceArgs> Source { get; set; } = null!;

        /// <summary>
        /// The reference to a vpc. Should not be used with {vpc_reference_uuid}
        /// </summary>
        [Input("vpcName")]
        public Input<string>? VpcName { get; set; }

        /// <summary>
        /// The reference to a vpc . Should not be used with {vpc_name} .
        /// </summary>
        [Input("vpcReferenceUuid")]
        public Input<string>? VpcReferenceUuid { get; set; }

        public PbrArgs()
        {
        }
    }

    public sealed class PbrState : Pulumi.ResourceArgs
    {
        /// <summary>
        /// Routing policy action. Must be one of {DENY, PERMIT, REROUTE} .
        /// </summary>
        [Input("action")]
        public Input<string>? Action { get; set; }

        /// <summary>
        /// The version of the API.
        /// </summary>
        [Input("apiVersion")]
        public Input<string>? ApiVersion { get; set; }

        [Input("destination")]
        public Input<Inputs.PbrDestinationGetArgs>? Destination { get; set; }

        /// <summary>
        /// Additionally create Policy in reverse direction. Should be used with {TCP, UDP with start and end port ranges and ICMP with icmp code and type}. Supported with 2022.x.
        /// </summary>
        [Input("isBidirectional")]
        public Input<bool>? IsBidirectional { get; set; }

        [Input("metadata")]
        private InputMap<string>? _metadata;

        /// <summary>
        /// The routing policies kind metadata.
        /// </summary>
        public InputMap<string> Metadata
        {
            get => _metadata ?? (_metadata = new InputMap<string>());
            set => _metadata = value;
        }

        /// <summary>
        /// name of policy
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

        /// <summary>
        /// priority of policy
        /// </summary>
        [Input("priority")]
        public Input<int>? Priority { get; set; }

        [Input("protocolParameters")]
        public Input<Inputs.PbrProtocolParametersGetArgs>? ProtocolParameters { get; set; }

        /// <summary>
        /// Protocol type of policy based routing. Must be one of {TCP, UDP, ICMP, PROTOCOL_NUMBER, ALL} .
        /// </summary>
        [Input("protocolType")]
        public Input<string>? ProtocolType { get; set; }

        [Input("serviceIpLists")]
        private InputList<string>? _serviceIpLists;

        /// <summary>
        /// IP addresses of network services. This field is valid only when action is REROUTE.
        /// </summary>
        public InputList<string> ServiceIpLists
        {
            get => _serviceIpLists ?? (_serviceIpLists = new InputList<string>());
            set => _serviceIpLists = value;
        }

        [Input("source")]
        public Input<Inputs.PbrSourceGetArgs>? Source { get; set; }

        /// <summary>
        /// The reference to a vpc. Should not be used with {vpc_reference_uuid}
        /// </summary>
        [Input("vpcName")]
        public Input<string>? VpcName { get; set; }

        /// <summary>
        /// The reference to a vpc . Should not be used with {vpc_name} .
        /// </summary>
        [Input("vpcReferenceUuid")]
        public Input<string>? VpcReferenceUuid { get; set; }

        public PbrState()
        {
        }
    }
}
