// *** 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 Cuemby.Equinix
{
    /// <summary>
    /// Provides a resource to attach device ports to VLANs.
    /// 
    /// Device and VLAN must be in the same facility.
    /// 
    /// If you need this resource to add the port back to bond on removal, set `force_bond = true`.
    /// 
    /// To learn more about Layer 2 networking in Equinix Metal, refer to
    /// 
    /// * &lt;https://metal.equinix.com/developers/docs/networking/layer2/&gt;
    /// * &lt;https://metal.equinix.com/developers/docs/networking/layer2-configs/&gt;
    /// 
    /// ## Example Usage
    /// ### Hybrid network type
    /// 
    /// ```csharp
    /// using Pulumi;
    /// using Equinix = Cuemby.Equinix;
    /// 
    /// class MyStack : Stack
    /// {
    ///     public MyStack()
    ///     {
    ///         var testMetalVlan = new Equinix.MetalVlan("testMetalVlan", new Equinix.MetalVlanArgs
    ///         {
    ///             Description = "VLAN in New Jersey",
    ///             Facility = "ny5",
    ///             ProjectId = local.Project_id,
    ///         });
    ///         var testMetalDevice = new Equinix.MetalDevice("testMetalDevice", new Equinix.MetalDeviceArgs
    ///         {
    ///             Hostname = "test",
    ///             Plan = "c3.small.x86",
    ///             Facilities = 
    ///             {
    ///                 "ny5",
    ///             },
    ///             OperatingSystem = "ubuntu_20_04",
    ///             BillingCycle = "hourly",
    ///             ProjectId = local.Project_id,
    ///         });
    ///         var testMetalDeviceNetworkType = new Equinix.MetalDeviceNetworkType("testMetalDeviceNetworkType", new Equinix.MetalDeviceNetworkTypeArgs
    ///         {
    ///             DeviceId = testMetalDevice.Id,
    ///             Type = "hybrid",
    ///         });
    ///         var testMetalPortVlanAttachment = new Equinix.MetalPortVlanAttachment("testMetalPortVlanAttachment", new Equinix.MetalPortVlanAttachmentArgs
    ///         {
    ///             DeviceId = testMetalDeviceNetworkType.Id,
    ///             PortName = "eth1",
    ///             VlanVnid = testMetalVlan.Vxlan,
    ///         });
    ///     }
    /// 
    /// }
    /// ```
    /// ### Layer 2 network
    /// 
    /// ```csharp
    /// using Pulumi;
    /// using Equinix = Cuemby.Equinix;
    /// 
    /// class MyStack : Stack
    /// {
    ///     public MyStack()
    ///     {
    ///         var testMetalDevice = new Equinix.MetalDevice("testMetalDevice", new Equinix.MetalDeviceArgs
    ///         {
    ///             Hostname = "test",
    ///             Plan = "c3.small.x86",
    ///             Facilities = 
    ///             {
    ///                 "ny5",
    ///             },
    ///             OperatingSystem = "ubuntu_20_04",
    ///             BillingCycle = "hourly",
    ///             ProjectId = local.Project_id,
    ///         });
    ///         var testMetalDeviceNetworkType = new Equinix.MetalDeviceNetworkType("testMetalDeviceNetworkType", new Equinix.MetalDeviceNetworkTypeArgs
    ///         {
    ///             DeviceId = testMetalDevice.Id,
    ///             Type = "layer2-individual",
    ///         });
    ///         var test1MetalVlan = new Equinix.MetalVlan("test1MetalVlan", new Equinix.MetalVlanArgs
    ///         {
    ///             Description = "VLAN in New Jersey",
    ///             Facility = "ny5",
    ///             ProjectId = local.Project_id,
    ///         });
    ///         var test2MetalVlan = new Equinix.MetalVlan("test2MetalVlan", new Equinix.MetalVlanArgs
    ///         {
    ///             Description = "VLAN in New Jersey",
    ///             Facility = "ny5",
    ///             ProjectId = local.Project_id,
    ///         });
    ///         var test1MetalPortVlanAttachment = new Equinix.MetalPortVlanAttachment("test1MetalPortVlanAttachment", new Equinix.MetalPortVlanAttachmentArgs
    ///         {
    ///             DeviceId = testMetalDeviceNetworkType.Id,
    ///             VlanVnid = test1MetalVlan.Vxlan,
    ///             PortName = "eth1",
    ///         });
    ///         var test2MetalPortVlanAttachment = new Equinix.MetalPortVlanAttachment("test2MetalPortVlanAttachment", new Equinix.MetalPortVlanAttachmentArgs
    ///         {
    ///             DeviceId = testMetalDeviceNetworkType.Id,
    ///             VlanVnid = test2MetalVlan.Vxlan,
    ///             PortName = "eth1",
    ///             Native = true,
    ///         }, new CustomResourceOptions
    ///         {
    ///             DependsOn = 
    ///             {
    ///                 "equinix_metal_port_vlan_attachment.test1",
    ///             },
    ///         });
    ///     }
    /// 
    /// }
    /// ```
    /// ## Attribute Referece
    /// 
    /// In addition to all arguments above, the following attributes are exported:
    /// 
    /// * `id` - UUID of device port used in the assignment.
    /// * `vlan_id` - UUID of VLAN API resource.
    /// * `port_id` - UUID of device port.
    /// </summary>
    [EquinixResourceType("equinix:index/metalPortVlanAttachment:MetalPortVlanAttachment")]
    public partial class MetalPortVlanAttachment : Pulumi.CustomResource
    {
        /// <summary>
        /// ID of device to be assigned to the VLAN.
        /// </summary>
        [Output("deviceId")]
        public Output<string> DeviceId { get; private set; } = null!;

        /// <summary>
        /// Add port back to the bond when this resource is removed. Default is
        /// `false`.
        /// </summary>
        [Output("forceBond")]
        public Output<bool?> ForceBond { get; private set; } = null!;

        /// <summary>
        /// Mark this VLAN a native VLAN on the port. This can be used only if this
        /// assignment assigns second or further VLAN to the port. To ensure that this attachment is not first
        /// on a port, you can use `depends_on` pointing to another `equinix.MetalPortVlanAttachment`, just
        /// like in the layer2-individual example above.
        /// </summary>
        [Output("native")]
        public Output<bool?> Native { get; private set; } = null!;

        /// <summary>
        /// UUID of device port
        /// </summary>
        [Output("portId")]
        public Output<string> PortId { get; private set; } = null!;

        /// <summary>
        /// Name of network port to be assigned to the VLAN.
        /// </summary>
        [Output("portName")]
        public Output<string> PortName { get; private set; } = null!;

        /// <summary>
        /// UUID of VLAN API resource
        /// </summary>
        [Output("vlanId")]
        public Output<string> VlanId { get; private set; } = null!;

        /// <summary>
        /// VXLAN Network Identifier.
        /// </summary>
        [Output("vlanVnid")]
        public Output<int> VlanVnid { get; private set; } = null!;


        /// <summary>
        /// Create a MetalPortVlanAttachment 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 MetalPortVlanAttachment(string name, MetalPortVlanAttachmentArgs args, CustomResourceOptions? options = null)
            : base("equinix:index/metalPortVlanAttachment:MetalPortVlanAttachment", name, args ?? new MetalPortVlanAttachmentArgs(), MakeResourceOptions(options, ""))
        {
        }

        private MetalPortVlanAttachment(string name, Input<string> id, MetalPortVlanAttachmentState? state = null, CustomResourceOptions? options = null)
            : base("equinix:index/metalPortVlanAttachment:MetalPortVlanAttachment", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
                PluginDownloadURL = "github://api.github.com/cuemby",
            };
            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 MetalPortVlanAttachment 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 MetalPortVlanAttachment Get(string name, Input<string> id, MetalPortVlanAttachmentState? state = null, CustomResourceOptions? options = null)
        {
            return new MetalPortVlanAttachment(name, id, state, options);
        }
    }

    public sealed class MetalPortVlanAttachmentArgs : Pulumi.ResourceArgs
    {
        /// <summary>
        /// ID of device to be assigned to the VLAN.
        /// </summary>
        [Input("deviceId", required: true)]
        public Input<string> DeviceId { get; set; } = null!;

        /// <summary>
        /// Add port back to the bond when this resource is removed. Default is
        /// `false`.
        /// </summary>
        [Input("forceBond")]
        public Input<bool>? ForceBond { get; set; }

        /// <summary>
        /// Mark this VLAN a native VLAN on the port. This can be used only if this
        /// assignment assigns second or further VLAN to the port. To ensure that this attachment is not first
        /// on a port, you can use `depends_on` pointing to another `equinix.MetalPortVlanAttachment`, just
        /// like in the layer2-individual example above.
        /// </summary>
        [Input("native")]
        public Input<bool>? Native { get; set; }

        /// <summary>
        /// Name of network port to be assigned to the VLAN.
        /// </summary>
        [Input("portName", required: true)]
        public Input<string> PortName { get; set; } = null!;

        /// <summary>
        /// VXLAN Network Identifier.
        /// </summary>
        [Input("vlanVnid", required: true)]
        public Input<int> VlanVnid { get; set; } = null!;

        public MetalPortVlanAttachmentArgs()
        {
        }
    }

    public sealed class MetalPortVlanAttachmentState : Pulumi.ResourceArgs
    {
        /// <summary>
        /// ID of device to be assigned to the VLAN.
        /// </summary>
        [Input("deviceId")]
        public Input<string>? DeviceId { get; set; }

        /// <summary>
        /// Add port back to the bond when this resource is removed. Default is
        /// `false`.
        /// </summary>
        [Input("forceBond")]
        public Input<bool>? ForceBond { get; set; }

        /// <summary>
        /// Mark this VLAN a native VLAN on the port. This can be used only if this
        /// assignment assigns second or further VLAN to the port. To ensure that this attachment is not first
        /// on a port, you can use `depends_on` pointing to another `equinix.MetalPortVlanAttachment`, just
        /// like in the layer2-individual example above.
        /// </summary>
        [Input("native")]
        public Input<bool>? Native { get; set; }

        /// <summary>
        /// UUID of device port
        /// </summary>
        [Input("portId")]
        public Input<string>? PortId { get; set; }

        /// <summary>
        /// Name of network port to be assigned to the VLAN.
        /// </summary>
        [Input("portName")]
        public Input<string>? PortName { get; set; }

        /// <summary>
        /// UUID of VLAN API resource
        /// </summary>
        [Input("vlanId")]
        public Input<string>? VlanId { get; set; }

        /// <summary>
        /// VXLAN Network Identifier.
        /// </summary>
        [Input("vlanVnid")]
        public Input<int>? VlanVnid { get; set; }

        public MetalPortVlanAttachmentState()
        {
        }
    }
}
