# coding=utf-8
# *** 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! ***

import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from . import _utilities, _tables
from . import outputs
from ._inputs import *

__all__ = ['HostPortGroup']


class HostPortGroup(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 active_nics: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 allow_forged_transmits: Optional[pulumi.Input[bool]] = None,
                 allow_mac_changes: Optional[pulumi.Input[bool]] = None,
                 allow_promiscuous: Optional[pulumi.Input[bool]] = None,
                 check_beacon: Optional[pulumi.Input[bool]] = None,
                 failback: Optional[pulumi.Input[bool]] = None,
                 host_system_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 notify_switches: Optional[pulumi.Input[bool]] = None,
                 shaping_average_bandwidth: Optional[pulumi.Input[int]] = None,
                 shaping_burst_size: Optional[pulumi.Input[int]] = None,
                 shaping_enabled: Optional[pulumi.Input[bool]] = None,
                 shaping_peak_bandwidth: Optional[pulumi.Input[int]] = None,
                 standby_nics: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 teaming_policy: Optional[pulumi.Input[str]] = None,
                 virtual_switch_name: Optional[pulumi.Input[str]] = None,
                 vlan_id: Optional[pulumi.Input[int]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        The `HostPortGroup` resource can be used to manage vSphere standard
        port groups on an ESXi host. These port groups are connected to standard
        virtual switches, which can be managed by the
        `HostVirtualSwitch` resource.

        For an overview on vSphere networking concepts, see [this page][ref-vsphere-net-concepts].

        [ref-vsphere-net-concepts]: https://docs.vmware.com/en/VMware-vSphere/6.5/com.vmware.vsphere.networking.doc/GUID-2B11DBB8-CB3C-4AFF-8885-EFEA0FC562F4.html

        ## Example Usage
        ### Create a virtual switch and bind a port group to it

        ```python
        import pulumi
        import pulumi_vsphere as vsphere

        datacenter = vsphere.get_datacenter(name="dc1")
        esxi_host = vsphere.get_host(datacenter_id=datacenter.id,
            name="esxi1")
        switch = vsphere.HostVirtualSwitch("switch",
            active_nics=["vmnic0"],
            host_system_id=esxi_host.id,
            network_adapters=[
                "vmnic0",
                "vmnic1",
            ],
            standby_nics=["vmnic1"])
        pg = vsphere.HostPortGroup("pg",
            host_system_id=esxi_host.id,
            virtual_switch_name=switch.name)
        ```
        ### Create a port group with VLAN set and some overrides

        This example sets the trunk mode VLAN (`4095`, which passes through all tags)
        and sets
        `allow_promiscuous`
        to ensure that all traffic is seen on the port. The latter setting overrides
        the implicit default of `false` set on the virtual switch.

        ```python
        import pulumi
        import pulumi_vsphere as vsphere

        datacenter = vsphere.get_datacenter(name="dc1")
        esxi_host = vsphere.get_host(datacenter_id=datacenter.id,
            name="esxi1")
        switch = vsphere.HostVirtualSwitch("switch",
            active_nics=["vmnic0"],
            host_system_id=esxi_host.id,
            network_adapters=[
                "vmnic0",
                "vmnic1",
            ],
            standby_nics=["vmnic1"])
        pg = vsphere.HostPortGroup("pg",
            allow_promiscuous=True,
            host_system_id=esxi_host.id,
            virtual_switch_name=switch.name,
            vlan_id=4095)
        ```
        ## Importing

        An existing host port group can be [imported][docs-import] into this resource
        using the host port group's ID. An example is below:

        [docs-import]: /docs/import/index.html

        ```python
        import pulumi
        ```

        The above would import the `Management` host port group from host with ID `host-123`.

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[Sequence[pulumi.Input[str]]] active_nics: List of active network adapters used for load balancing.
        :param pulumi.Input[bool] allow_forged_transmits: Controls whether or not the virtual network adapter is allowed to send network traffic with a different MAC address than
               that of its own.
        :param pulumi.Input[bool] allow_mac_changes: Controls whether or not the Media Access Control (MAC) address can be changed.
        :param pulumi.Input[bool] allow_promiscuous: Enable promiscuous mode on the network. This flag indicates whether or not all traffic is seen on a given port.
        :param pulumi.Input[bool] check_beacon: Enable beacon probing. Requires that the vSwitch has been configured to use a beacon. If disabled, link status is used
               only.
        :param pulumi.Input[bool] failback: If true, the teaming policy will re-activate failed interfaces higher in precedence when they come back up.
        :param pulumi.Input[str] host_system_id: The managed object ID of
               the host to set the port group up on. Forces a new resource if changed.
        :param pulumi.Input[str] name: The name of the port group.  Forces a new resource if
               changed.
        :param pulumi.Input[bool] notify_switches: If true, the teaming policy will notify the broadcast network of a NIC failover, triggering cache updates.
        :param pulumi.Input[int] shaping_average_bandwidth: The average bandwidth in bits per second if traffic shaping is enabled.
        :param pulumi.Input[int] shaping_burst_size: The maximum burst size allowed in bytes if traffic shaping is enabled.
        :param pulumi.Input[bool] shaping_enabled: Enable traffic shaping on this virtual switch or port group.
        :param pulumi.Input[int] shaping_peak_bandwidth: The peak bandwidth during bursts in bits per second if traffic shaping is enabled.
        :param pulumi.Input[Sequence[pulumi.Input[str]]] standby_nics: List of standby network adapters used for failover.
        :param pulumi.Input[str] teaming_policy: The network adapter teaming policy. Can be one of loadbalance_ip, loadbalance_srcmac, loadbalance_srcid, or
               failover_explicit.
        :param pulumi.Input[str] virtual_switch_name: The name of the virtual switch to bind
               this port group to. Forces a new resource if changed.
        :param pulumi.Input[int] vlan_id: The VLAN ID/trunk mode for this port group.  An ID of
               `0` denotes no tagging, an ID of `1`-`4094` tags with the specific ID, and an
               ID of `4095` enables trunk mode, allowing the guest to manage its own
               tagging. Default: `0`.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = _utilities.get_version()
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = dict()

            __props__['active_nics'] = active_nics
            __props__['allow_forged_transmits'] = allow_forged_transmits
            __props__['allow_mac_changes'] = allow_mac_changes
            __props__['allow_promiscuous'] = allow_promiscuous
            __props__['check_beacon'] = check_beacon
            __props__['failback'] = failback
            if host_system_id is None and not opts.urn:
                raise TypeError("Missing required property 'host_system_id'")
            __props__['host_system_id'] = host_system_id
            __props__['name'] = name
            __props__['notify_switches'] = notify_switches
            __props__['shaping_average_bandwidth'] = shaping_average_bandwidth
            __props__['shaping_burst_size'] = shaping_burst_size
            __props__['shaping_enabled'] = shaping_enabled
            __props__['shaping_peak_bandwidth'] = shaping_peak_bandwidth
            __props__['standby_nics'] = standby_nics
            __props__['teaming_policy'] = teaming_policy
            if virtual_switch_name is None and not opts.urn:
                raise TypeError("Missing required property 'virtual_switch_name'")
            __props__['virtual_switch_name'] = virtual_switch_name
            __props__['vlan_id'] = vlan_id
            __props__['computed_policy'] = None
            __props__['key'] = None
            __props__['ports'] = None
        super(HostPortGroup, __self__).__init__(
            'vsphere:index/hostPortGroup:HostPortGroup',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            active_nics: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
            allow_forged_transmits: Optional[pulumi.Input[bool]] = None,
            allow_mac_changes: Optional[pulumi.Input[bool]] = None,
            allow_promiscuous: Optional[pulumi.Input[bool]] = None,
            check_beacon: Optional[pulumi.Input[bool]] = None,
            computed_policy: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
            failback: Optional[pulumi.Input[bool]] = None,
            host_system_id: Optional[pulumi.Input[str]] = None,
            key: Optional[pulumi.Input[str]] = None,
            name: Optional[pulumi.Input[str]] = None,
            notify_switches: Optional[pulumi.Input[bool]] = None,
            ports: Optional[pulumi.Input[pulumi.InputType['HostPortGroupPortsArgs']]] = None,
            shaping_average_bandwidth: Optional[pulumi.Input[int]] = None,
            shaping_burst_size: Optional[pulumi.Input[int]] = None,
            shaping_enabled: Optional[pulumi.Input[bool]] = None,
            shaping_peak_bandwidth: Optional[pulumi.Input[int]] = None,
            standby_nics: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
            teaming_policy: Optional[pulumi.Input[str]] = None,
            virtual_switch_name: Optional[pulumi.Input[str]] = None,
            vlan_id: Optional[pulumi.Input[int]] = None) -> 'HostPortGroup':
        """
        Get an existing HostPortGroup resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[Sequence[pulumi.Input[str]]] active_nics: List of active network adapters used for load balancing.
        :param pulumi.Input[bool] allow_forged_transmits: Controls whether or not the virtual network adapter is allowed to send network traffic with a different MAC address than
               that of its own.
        :param pulumi.Input[bool] allow_mac_changes: Controls whether or not the Media Access Control (MAC) address can be changed.
        :param pulumi.Input[bool] allow_promiscuous: Enable promiscuous mode on the network. This flag indicates whether or not all traffic is seen on a given port.
        :param pulumi.Input[bool] check_beacon: Enable beacon probing. Requires that the vSwitch has been configured to use a beacon. If disabled, link status is used
               only.
        :param pulumi.Input[Mapping[str, pulumi.Input[str]]] computed_policy: A map with a full set of the policy
               options computed from defaults and overrides,
               explaining the effective policy for this port group.
        :param pulumi.Input[bool] failback: If true, the teaming policy will re-activate failed interfaces higher in precedence when they come back up.
        :param pulumi.Input[str] host_system_id: The managed object ID of
               the host to set the port group up on. Forces a new resource if changed.
        :param pulumi.Input[str] key: The key for this port group as returned from the vSphere API.
        :param pulumi.Input[str] name: The name of the port group.  Forces a new resource if
               changed.
        :param pulumi.Input[bool] notify_switches: If true, the teaming policy will notify the broadcast network of a NIC failover, triggering cache updates.
        :param pulumi.Input[pulumi.InputType['HostPortGroupPortsArgs']] ports: A list of ports that currently exist and are used on this port group.
        :param pulumi.Input[int] shaping_average_bandwidth: The average bandwidth in bits per second if traffic shaping is enabled.
        :param pulumi.Input[int] shaping_burst_size: The maximum burst size allowed in bytes if traffic shaping is enabled.
        :param pulumi.Input[bool] shaping_enabled: Enable traffic shaping on this virtual switch or port group.
        :param pulumi.Input[int] shaping_peak_bandwidth: The peak bandwidth during bursts in bits per second if traffic shaping is enabled.
        :param pulumi.Input[Sequence[pulumi.Input[str]]] standby_nics: List of standby network adapters used for failover.
        :param pulumi.Input[str] teaming_policy: The network adapter teaming policy. Can be one of loadbalance_ip, loadbalance_srcmac, loadbalance_srcid, or
               failover_explicit.
        :param pulumi.Input[str] virtual_switch_name: The name of the virtual switch to bind
               this port group to. Forces a new resource if changed.
        :param pulumi.Input[int] vlan_id: The VLAN ID/trunk mode for this port group.  An ID of
               `0` denotes no tagging, an ID of `1`-`4094` tags with the specific ID, and an
               ID of `4095` enables trunk mode, allowing the guest to manage its own
               tagging. Default: `0`.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["active_nics"] = active_nics
        __props__["allow_forged_transmits"] = allow_forged_transmits
        __props__["allow_mac_changes"] = allow_mac_changes
        __props__["allow_promiscuous"] = allow_promiscuous
        __props__["check_beacon"] = check_beacon
        __props__["computed_policy"] = computed_policy
        __props__["failback"] = failback
        __props__["host_system_id"] = host_system_id
        __props__["key"] = key
        __props__["name"] = name
        __props__["notify_switches"] = notify_switches
        __props__["ports"] = ports
        __props__["shaping_average_bandwidth"] = shaping_average_bandwidth
        __props__["shaping_burst_size"] = shaping_burst_size
        __props__["shaping_enabled"] = shaping_enabled
        __props__["shaping_peak_bandwidth"] = shaping_peak_bandwidth
        __props__["standby_nics"] = standby_nics
        __props__["teaming_policy"] = teaming_policy
        __props__["virtual_switch_name"] = virtual_switch_name
        __props__["vlan_id"] = vlan_id
        return HostPortGroup(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="activeNics")
    def active_nics(self) -> pulumi.Output[Optional[Sequence[str]]]:
        """
        List of active network adapters used for load balancing.
        """
        return pulumi.get(self, "active_nics")

    @property
    @pulumi.getter(name="allowForgedTransmits")
    def allow_forged_transmits(self) -> pulumi.Output[Optional[bool]]:
        """
        Controls whether or not the virtual network adapter is allowed to send network traffic with a different MAC address than
        that of its own.
        """
        return pulumi.get(self, "allow_forged_transmits")

    @property
    @pulumi.getter(name="allowMacChanges")
    def allow_mac_changes(self) -> pulumi.Output[Optional[bool]]:
        """
        Controls whether or not the Media Access Control (MAC) address can be changed.
        """
        return pulumi.get(self, "allow_mac_changes")

    @property
    @pulumi.getter(name="allowPromiscuous")
    def allow_promiscuous(self) -> pulumi.Output[Optional[bool]]:
        """
        Enable promiscuous mode on the network. This flag indicates whether or not all traffic is seen on a given port.
        """
        return pulumi.get(self, "allow_promiscuous")

    @property
    @pulumi.getter(name="checkBeacon")
    def check_beacon(self) -> pulumi.Output[Optional[bool]]:
        """
        Enable beacon probing. Requires that the vSwitch has been configured to use a beacon. If disabled, link status is used
        only.
        """
        return pulumi.get(self, "check_beacon")

    @property
    @pulumi.getter(name="computedPolicy")
    def computed_policy(self) -> pulumi.Output[Mapping[str, str]]:
        """
        A map with a full set of the policy
        options computed from defaults and overrides,
        explaining the effective policy for this port group.
        """
        return pulumi.get(self, "computed_policy")

    @property
    @pulumi.getter
    def failback(self) -> pulumi.Output[Optional[bool]]:
        """
        If true, the teaming policy will re-activate failed interfaces higher in precedence when they come back up.
        """
        return pulumi.get(self, "failback")

    @property
    @pulumi.getter(name="hostSystemId")
    def host_system_id(self) -> pulumi.Output[str]:
        """
        The managed object ID of
        the host to set the port group up on. Forces a new resource if changed.
        """
        return pulumi.get(self, "host_system_id")

    @property
    @pulumi.getter
    def key(self) -> pulumi.Output[str]:
        """
        The key for this port group as returned from the vSphere API.
        """
        return pulumi.get(self, "key")

    @property
    @pulumi.getter
    def name(self) -> pulumi.Output[str]:
        """
        The name of the port group.  Forces a new resource if
        changed.
        """
        return pulumi.get(self, "name")

    @property
    @pulumi.getter(name="notifySwitches")
    def notify_switches(self) -> pulumi.Output[Optional[bool]]:
        """
        If true, the teaming policy will notify the broadcast network of a NIC failover, triggering cache updates.
        """
        return pulumi.get(self, "notify_switches")

    @property
    @pulumi.getter
    def ports(self) -> pulumi.Output['outputs.HostPortGroupPorts']:
        """
        A list of ports that currently exist and are used on this port group.
        """
        return pulumi.get(self, "ports")

    @property
    @pulumi.getter(name="shapingAverageBandwidth")
    def shaping_average_bandwidth(self) -> pulumi.Output[Optional[int]]:
        """
        The average bandwidth in bits per second if traffic shaping is enabled.
        """
        return pulumi.get(self, "shaping_average_bandwidth")

    @property
    @pulumi.getter(name="shapingBurstSize")
    def shaping_burst_size(self) -> pulumi.Output[Optional[int]]:
        """
        The maximum burst size allowed in bytes if traffic shaping is enabled.
        """
        return pulumi.get(self, "shaping_burst_size")

    @property
    @pulumi.getter(name="shapingEnabled")
    def shaping_enabled(self) -> pulumi.Output[Optional[bool]]:
        """
        Enable traffic shaping on this virtual switch or port group.
        """
        return pulumi.get(self, "shaping_enabled")

    @property
    @pulumi.getter(name="shapingPeakBandwidth")
    def shaping_peak_bandwidth(self) -> pulumi.Output[Optional[int]]:
        """
        The peak bandwidth during bursts in bits per second if traffic shaping is enabled.
        """
        return pulumi.get(self, "shaping_peak_bandwidth")

    @property
    @pulumi.getter(name="standbyNics")
    def standby_nics(self) -> pulumi.Output[Optional[Sequence[str]]]:
        """
        List of standby network adapters used for failover.
        """
        return pulumi.get(self, "standby_nics")

    @property
    @pulumi.getter(name="teamingPolicy")
    def teaming_policy(self) -> pulumi.Output[Optional[str]]:
        """
        The network adapter teaming policy. Can be one of loadbalance_ip, loadbalance_srcmac, loadbalance_srcid, or
        failover_explicit.
        """
        return pulumi.get(self, "teaming_policy")

    @property
    @pulumi.getter(name="virtualSwitchName")
    def virtual_switch_name(self) -> pulumi.Output[str]:
        """
        The name of the virtual switch to bind
        this port group to. Forces a new resource if changed.
        """
        return pulumi.get(self, "virtual_switch_name")

    @property
    @pulumi.getter(name="vlanId")
    def vlan_id(self) -> pulumi.Output[Optional[int]]:
        """
        The VLAN ID/trunk mode for this port group.  An ID of
        `0` denotes no tagging, an ID of `1`-`4094` tags with the specific ID, and an
        ID of `4095` enables trunk mode, allowing the guest to manage its own
        tagging. Default: `0`.
        """
        return pulumi.get(self, "vlan_id")

    def translate_output_property(self, prop):
        return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

