unifi logo
Unifi v0.0.3, Dec 5 22

unifi.Device

Explore with Pulumi AI

Example Usage

using System.Collections.Generic;
using Pulumi;
using Unifi = Pulumi.Unifi;
using Unifi = Pulumiverse.Unifi;

return await Deployment.RunAsync(() => 
{
    var disabled = Unifi.Port.GetProfile.Invoke(new()
    {
        Name = "Disabled",
    });

    var poe = new Unifi.Port.Profile("poe", new()
    {
        Forward = "customize",
        NativeNetworkconfId = @var.Native_network_id,
        TaggedNetworkconfIds = new[]
        {
            @var.Some_vlan_network_id,
        },
        PoeMode = "auto",
    });

    var us24Poe = new Unifi.Device("us24Poe", new()
    {
        Mac = "01:23:45:67:89:AB",
        PortOverrides = new[]
        {
            new Unifi.Inputs.DevicePortOverrideArgs
            {
                Number = 1,
                Name = "port w/ poe",
                PortProfileId = poe.Id,
            },
            new Unifi.Inputs.DevicePortOverrideArgs
            {
                Number = 2,
                Name = "disabled",
                PortProfileId = disabled.Apply(getProfileResult => getProfileResult.Id),
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-unifi/sdk/go/unifi"
	"github.com/pulumiverse/pulumi-unifi/sdk/go/unifi/port"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		disabled, err := port.LookupProfile(ctx, &port.LookupProfileArgs{
			Name: pulumi.StringRef("Disabled"),
		}, nil)
		if err != nil {
			return err
		}
		poe, err := port.NewProfile(ctx, "poe", &port.ProfileArgs{
			Forward:             pulumi.String("customize"),
			NativeNetworkconfId: pulumi.Any(_var.Native_network_id),
			TaggedNetworkconfIds: pulumi.StringArray{
				_var.Some_vlan_network_id,
			},
			PoeMode: pulumi.String("auto"),
		})
		if err != nil {
			return err
		}
		_, err = unifi.NewDevice(ctx, "us24Poe", &unifi.DeviceArgs{
			Mac: pulumi.String("01:23:45:67:89:AB"),
			PortOverrides: unifi.DevicePortOverrideArray{
				&unifi.DevicePortOverrideArgs{
					Number:        pulumi.Int(1),
					Name:          pulumi.String("port w/ poe"),
					PortProfileId: poe.ID(),
				},
				&unifi.DevicePortOverrideArgs{
					Number:        pulumi.Int(2),
					Name:          pulumi.String("disabled"),
					PortProfileId: pulumi.String(disabled.Id),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.unifi.port.PortFunctions;
import com.pulumi.unifi.port.inputs.GetProfileArgs;
import com.pulumi.unifi.port.Profile;
import com.pulumi.unifi.port.ProfileArgs;
import com.pulumi.unifi.Device;
import com.pulumi.unifi.DeviceArgs;
import com.pulumi.unifi.inputs.DevicePortOverrideArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var disabled = PortFunctions.getProfile(GetProfileArgs.builder()
            .name("Disabled")
            .build());

        var poe = new Profile("poe", ProfileArgs.builder()        
            .forward("customize")
            .nativeNetworkconfId(var_.native_network_id())
            .taggedNetworkconfIds(var_.some_vlan_network_id())
            .poeMode("auto")
            .build());

        var us24Poe = new Device("us24Poe", DeviceArgs.builder()        
            .mac("01:23:45:67:89:AB")
            .portOverrides(            
                DevicePortOverrideArgs.builder()
                    .number(1)
                    .name("port w/ poe")
                    .portProfileId(poe.id())
                    .build(),
                DevicePortOverrideArgs.builder()
                    .number(2)
                    .name("disabled")
                    .portProfileId(disabled.applyValue(getProfileResult -> getProfileResult.id()))
                    .build())
            .build());

    }
}
import pulumi
import pulumi_unifi as unifi
import pulumiverse_unifi as unifi

disabled = unifi.port.get_profile(name="Disabled")
poe = unifi.port.Profile("poe",
    forward="customize",
    native_networkconf_id=var["native_network_id"],
    tagged_networkconf_ids=[var["some_vlan_network_id"]],
    poe_mode="auto")
us24_poe = unifi.Device("us24Poe",
    mac="01:23:45:67:89:AB",
    port_overrides=[
        unifi.DevicePortOverrideArgs(
            number=1,
            name="port w/ poe",
            port_profile_id=poe.id,
        ),
        unifi.DevicePortOverrideArgs(
            number=2,
            name="disabled",
            port_profile_id=disabled.id,
        ),
    ])
import * as pulumi from "@pulumi/pulumi";
import * as unifi from "@pulumi/unifi";
import * as unifi from "@pulumiverse/unifi";

const disabled = unifi.port.getProfile({
    name: "Disabled",
});
const poe = new unifi.port.Profile("poe", {
    forward: "customize",
    nativeNetworkconfId: _var.native_network_id,
    taggedNetworkconfIds: [_var.some_vlan_network_id],
    poeMode: "auto",
});
const us24Poe = new unifi.Device("us24Poe", {
    mac: "01:23:45:67:89:AB",
    portOverrides: [
        {
            number: 1,
            name: "port w/ poe",
            portProfileId: poe.id,
        },
        {
            number: 2,
            name: "disabled",
            portProfileId: disabled.then(disabled => disabled.id),
        },
    ],
});
resources:
  poe:
    type: unifi:port:Profile
    properties:
      forward: customize
      nativeNetworkconfId: ${var.native_network_id}
      taggedNetworkconfIds:
        - ${var.some_vlan_network_id}
      poeMode: auto
  us24Poe:
    type: unifi:Device
    properties:
      # optionally specify MAC address to skip manually importing
      #   # manual import is the safest way to add a device
      mac: 01:23:45:67:89:AB
      portOverrides:
        - number: 1
          name: port w/ poe
          portProfileId: ${poe.id}
        - number: 2
          name: disabled
          portProfileId: ${disabled.id}
variables:
  disabled:
    fn::invoke:
      Function: unifi:port:getProfile
      Arguments:
        name: Disabled

Create Device Resource

new Device(name: string, args?: DeviceArgs, opts?: CustomResourceOptions);
@overload
def Device(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           mac: Optional[str] = None,
           name: Optional[str] = None,
           port_overrides: Optional[Sequence[DevicePortOverrideArgs]] = None,
           site: Optional[str] = None)
@overload
def Device(resource_name: str,
           args: Optional[DeviceArgs] = None,
           opts: Optional[ResourceOptions] = None)
func NewDevice(ctx *Context, name string, args *DeviceArgs, opts ...ResourceOption) (*Device, error)
public Device(string name, DeviceArgs? args = null, CustomResourceOptions? opts = null)
public Device(String name, DeviceArgs args)
public Device(String name, DeviceArgs args, CustomResourceOptions options)
type: unifi:Device
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args DeviceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args DeviceArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args DeviceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DeviceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args DeviceArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Device Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Device resource accepts the following input properties:

Mac string

The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).

Name string

The name of the device.

PortOverrides List<Pulumiverse.Unifi.Inputs.DevicePortOverrideArgs>

Settings overrides for specific switch ports.

Site string

The name of the site to associate the device with.

Mac string

The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).

Name string

The name of the device.

PortOverrides []DevicePortOverrideArgs

Settings overrides for specific switch ports.

Site string

The name of the site to associate the device with.

mac String

The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).

name String

The name of the device.

portOverrides List<DevicePortOverrideArgs>

Settings overrides for specific switch ports.

site String

The name of the site to associate the device with.

mac string

The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).

name string

The name of the device.

portOverrides DevicePortOverrideArgs[]

Settings overrides for specific switch ports.

site string

The name of the site to associate the device with.

mac str

The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).

name str

The name of the device.

port_overrides Sequence[DevicePortOverrideArgs]

Settings overrides for specific switch ports.

site str

The name of the site to associate the device with.

mac String

The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).

name String

The name of the device.

portOverrides List<Property Map>

Settings overrides for specific switch ports.

site String

The name of the site to associate the device with.

Outputs

All input properties are implicitly available as output properties. Additionally, the Device resource produces the following output properties:

Disabled bool

Specifies whether this device should be disabled.

Id string

The provider-assigned unique ID for this managed resource.

Disabled bool

Specifies whether this device should be disabled.

Id string

The provider-assigned unique ID for this managed resource.

disabled Boolean

Specifies whether this device should be disabled.

id String

The provider-assigned unique ID for this managed resource.

disabled boolean

Specifies whether this device should be disabled.

id string

The provider-assigned unique ID for this managed resource.

disabled bool

Specifies whether this device should be disabled.

id str

The provider-assigned unique ID for this managed resource.

disabled Boolean

Specifies whether this device should be disabled.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing Device Resource

Get an existing Device resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: DeviceState, opts?: CustomResourceOptions): Device
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        disabled: Optional[bool] = None,
        mac: Optional[str] = None,
        name: Optional[str] = None,
        port_overrides: Optional[Sequence[DevicePortOverrideArgs]] = None,
        site: Optional[str] = None) -> Device
func GetDevice(ctx *Context, name string, id IDInput, state *DeviceState, opts ...ResourceOption) (*Device, error)
public static Device Get(string name, Input<string> id, DeviceState? state, CustomResourceOptions? opts = null)
public static Device get(String name, Output<String> id, DeviceState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Disabled bool

Specifies whether this device should be disabled.

Mac string

The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).

Name string

The name of the device.

PortOverrides List<Pulumiverse.Unifi.Inputs.DevicePortOverrideArgs>

Settings overrides for specific switch ports.

Site string

The name of the site to associate the device with.

Disabled bool

Specifies whether this device should be disabled.

Mac string

The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).

Name string

The name of the device.

PortOverrides []DevicePortOverrideArgs

Settings overrides for specific switch ports.

Site string

The name of the site to associate the device with.

disabled Boolean

Specifies whether this device should be disabled.

mac String

The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).

name String

The name of the device.

portOverrides List<DevicePortOverrideArgs>

Settings overrides for specific switch ports.

site String

The name of the site to associate the device with.

disabled boolean

Specifies whether this device should be disabled.

mac string

The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).

name string

The name of the device.

portOverrides DevicePortOverrideArgs[]

Settings overrides for specific switch ports.

site string

The name of the site to associate the device with.

disabled bool

Specifies whether this device should be disabled.

mac str

The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).

name str

The name of the device.

port_overrides Sequence[DevicePortOverrideArgs]

Settings overrides for specific switch ports.

site str

The name of the site to associate the device with.

disabled Boolean

Specifies whether this device should be disabled.

mac String

The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).

name String

The name of the device.

portOverrides List<Property Map>

Settings overrides for specific switch ports.

site String

The name of the site to associate the device with.

Supporting Types

DevicePortOverride

Number int

Switch port number.

Name string

Human-readable name of the port.

PortProfileId string

ID of the Port Profile used on this port.

Number int

Switch port number.

Name string

Human-readable name of the port.

PortProfileId string

ID of the Port Profile used on this port.

number Integer

Switch port number.

name String

Human-readable name of the port.

portProfileId String

ID of the Port Profile used on this port.

number number

Switch port number.

name string

Human-readable name of the port.

portProfileId string

ID of the Port Profile used on this port.

number int

Switch port number.

name str

Human-readable name of the port.

port_profile_id str

ID of the Port Profile used on this port.

number Number

Switch port number.

name String

Human-readable name of the port.

portProfileId String

ID of the Port Profile used on this port.

Package Details

Repository
unifi pulumiverse/pulumi-unifi
License
Apache-2.0
Notes

This Pulumi package is based on the unifi Terraform Provider.