UNPKG

@natzka-oss/pulumi-netbox

Version:

A Pulumi package for creating and managing Netbox cloud resources.

198 lines (197 loc) 7.19 kB
import * as pulumi from "@pulumi/pulumi"; /** * From the [official documentation](https://netboxlabs.com/docs/netbox/models/dcim/macaddress/): * * > A MAC address object in NetBox comprises a single Ethernet link layer address, and represents a MAC address as reported by or assigned to a network interface. MAC addresses can be assigned to device and virtual machine interfaces. A MAC address can be specified as the primary MAC address for a given device or VM interface. * * ## Example Usage * * ### Creating a MAC address that is assigned to a virtual machine interface * * With `virtualMachineInterfaceId`: * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as netbox from "@natzka-oss/pulumi-netbox"; * * // Assuming a virtual machine with the id `123` exists * const _this = new netbox.virt.Interface("this", { * name: "eth0", * virtualMachineId: 123, * }); * const thisMacAddress = new netbox.MacAddress("this", { * macAddress: "00:1A:2B:3C:4D:5E", * virtualMachineInterfaceId: _this.id, * }); * ``` * * With `objectType` and `interfaceId`: * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as netbox from "@natzka-oss/pulumi-netbox"; * * // Assuming a virtual machine with the id `123` exists * const _this = new netbox.virt.Interface("this", { * name: "eth0", * virtualMachineId: 123, * }); * const thisMacAddress = new netbox.MacAddress("this", { * macAddress: "00:1A:2B:3C:4D:5E", * interfaceId: _this.id, * objectType: "virtualization.vminterface", * }); * ``` * * ### Creating a MAC address that is assigned to a device interface * * With `deviceInterfaceId`: * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as netbox from "@natzka-oss/pulumi-netbox"; * * // Assuming a device with the id `123` exists * const _this = new netbox.dcim.DeviceInterface("this", { * name: "eth0", * deviceId: 123, * type: "1000base-t", * }); * const thisMacAddress = new netbox.MacAddress("this", { * macAddress: "00:1A:2B:3C:4D:5E", * deviceInterfaceId: _this.id, * }); * ``` * * With `objectType` and `interfaceId`: * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as netbox from "@natzka-oss/pulumi-netbox"; * * // Assuming a device with the id `123` exists * const _this = new netbox.dcim.DeviceInterface("this", { * name: "eth0", * deviceId: 123, * type: "1000base-t", * }); * const thisMacAddress = new netbox.MacAddress("this", { * macAddress: "00:1A:2B:3C:4D:5E", * interfaceId: _this.id, * objectType: "dcim.interface", * }); * ``` * * ### Creating a MAC address that is not assigned to anything * * You can create a MAC address that is not assigned to anything by omitting the attributes mentioned above. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as netbox from "@natzka-oss/pulumi-netbox"; * * const _this = new netbox.MacAddress("this", {macAddress: "00:1A:2B:3C:4D:5E"}); * ``` */ export declare class MacAddress extends pulumi.CustomResource { /** * Get an existing MacAddress resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: MacAddressState, opts?: pulumi.CustomResourceOptions): MacAddress; /** * Returns true if the given object is an instance of MacAddress. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is MacAddress; readonly comments: pulumi.Output<string | undefined>; readonly customFields: pulumi.Output<{ [key: string]: string; } | undefined>; readonly description: pulumi.Output<string | undefined>; /** * Conflicts with `interfaceId` and `virtualMachineInterfaceId`. */ readonly deviceInterfaceId: pulumi.Output<number | undefined>; /** * Required when `objectType` is set. */ readonly interfaceId: pulumi.Output<number | undefined>; readonly macAddress: pulumi.Output<string>; /** * Valid values are `virtualization.vminterface` and `dcim.interface`. Required when `interfaceId` is set. */ readonly objectType: pulumi.Output<string | undefined>; readonly tags: pulumi.Output<string[] | undefined>; readonly tagsAlls: pulumi.Output<string[]>; /** * Conflicts with `interfaceId` and `deviceInterfaceId`. */ readonly virtualMachineInterfaceId: pulumi.Output<number | undefined>; /** * Create a MacAddress resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: MacAddressArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering MacAddress resources. */ export interface MacAddressState { comments?: pulumi.Input<string>; customFields?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; description?: pulumi.Input<string>; /** * Conflicts with `interfaceId` and `virtualMachineInterfaceId`. */ deviceInterfaceId?: pulumi.Input<number>; /** * Required when `objectType` is set. */ interfaceId?: pulumi.Input<number>; macAddress?: pulumi.Input<string>; /** * Valid values are `virtualization.vminterface` and `dcim.interface`. Required when `interfaceId` is set. */ objectType?: pulumi.Input<string>; tags?: pulumi.Input<pulumi.Input<string>[]>; tagsAlls?: pulumi.Input<pulumi.Input<string>[]>; /** * Conflicts with `interfaceId` and `deviceInterfaceId`. */ virtualMachineInterfaceId?: pulumi.Input<number>; } /** * The set of arguments for constructing a MacAddress resource. */ export interface MacAddressArgs { comments?: pulumi.Input<string>; customFields?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; description?: pulumi.Input<string>; /** * Conflicts with `interfaceId` and `virtualMachineInterfaceId`. */ deviceInterfaceId?: pulumi.Input<number>; /** * Required when `objectType` is set. */ interfaceId?: pulumi.Input<number>; macAddress: pulumi.Input<string>; /** * Valid values are `virtualization.vminterface` and `dcim.interface`. Required when `interfaceId` is set. */ objectType?: pulumi.Input<string>; tags?: pulumi.Input<pulumi.Input<string>[]>; /** * Conflicts with `interfaceId` and `deviceInterfaceId`. */ virtualMachineInterfaceId?: pulumi.Input<number>; }