netbox.DeviceBay
Explore with Pulumi AI
From the official documentation:
Device bays represent a space or slot within a device in which a field-replaceable device may be installed. A common example is that of a chassis-based server that holds a number of blades which may contain device components that don’t fit the module pattern. Devices in turn hold additional components that become available to the parent device.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as netbox from "@pulumi/netbox";
const exampleTenant = new netbox.Tenant("exampleTenant", {});
const exampleSite = new netbox.Site("exampleSite", {status: "active"});
const exampleManufacturer = new netbox.Manufacturer("exampleManufacturer", {});
const exampleDeviceType = new netbox.DeviceType("exampleDeviceType", {
model: "example_device_type",
manufacturerId: exampleManufacturer.manufacturerId,
subdeviceRole: "parent",
});
const exampleInstalledDeviceType = new netbox.DeviceType("exampleInstalledDeviceType", {
model: "example_device_type_installed",
manufacturerId: exampleManufacturer.manufacturerId,
uHeight: 0,
subdeviceRole: "child",
});
const exampleDeviceRole = new netbox.DeviceRole("exampleDeviceRole", {colorHex: "123456"});
const exampleDevice = new netbox.Device("exampleDevice", {
deviceTypeId: exampleDeviceType.deviceTypeId,
tenantId: exampleTenant.tenantId,
roleId: exampleDeviceRole.deviceRoleId,
siteId: exampleSite.siteId,
});
const exampleInstalledDevice = new netbox.Device("exampleInstalledDevice", {
deviceTypeId: exampleInstalledDeviceType.deviceTypeId,
tenantId: exampleTenant.tenantId,
roleId: exampleDeviceRole.deviceRoleId,
siteId: exampleSite.siteId,
});
const exampleDeviceBay = new netbox.DeviceBay("exampleDeviceBay", {
deviceId: exampleDevice.deviceId,
label: "example_label",
description: "example_description",
installedDeviceId: exampleInstalledDevice.deviceId,
});
import pulumi
import pulumi_netbox as netbox
example_tenant = netbox.Tenant("exampleTenant")
example_site = netbox.Site("exampleSite", status="active")
example_manufacturer = netbox.Manufacturer("exampleManufacturer")
example_device_type = netbox.DeviceType("exampleDeviceType",
model="example_device_type",
manufacturer_id=example_manufacturer.manufacturer_id,
subdevice_role="parent")
example_installed_device_type = netbox.DeviceType("exampleInstalledDeviceType",
model="example_device_type_installed",
manufacturer_id=example_manufacturer.manufacturer_id,
u_height=0,
subdevice_role="child")
example_device_role = netbox.DeviceRole("exampleDeviceRole", color_hex="123456")
example_device = netbox.Device("exampleDevice",
device_type_id=example_device_type.device_type_id,
tenant_id=example_tenant.tenant_id,
role_id=example_device_role.device_role_id,
site_id=example_site.site_id)
example_installed_device = netbox.Device("exampleInstalledDevice",
device_type_id=example_installed_device_type.device_type_id,
tenant_id=example_tenant.tenant_id,
role_id=example_device_role.device_role_id,
site_id=example_site.site_id)
example_device_bay = netbox.DeviceBay("exampleDeviceBay",
device_id=example_device.device_id,
label="example_label",
description="example_description",
installed_device_id=example_installed_device.device_id)
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v5/netbox"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleTenant, err := netbox.NewTenant(ctx, "exampleTenant", nil)
if err != nil {
return err
}
exampleSite, err := netbox.NewSite(ctx, "exampleSite", &netbox.SiteArgs{
Status: pulumi.String("active"),
})
if err != nil {
return err
}
exampleManufacturer, err := netbox.NewManufacturer(ctx, "exampleManufacturer", nil)
if err != nil {
return err
}
exampleDeviceType, err := netbox.NewDeviceType(ctx, "exampleDeviceType", &netbox.DeviceTypeArgs{
Model: pulumi.String("example_device_type"),
ManufacturerId: exampleManufacturer.ManufacturerId,
SubdeviceRole: pulumi.String("parent"),
})
if err != nil {
return err
}
exampleInstalledDeviceType, err := netbox.NewDeviceType(ctx, "exampleInstalledDeviceType", &netbox.DeviceTypeArgs{
Model: pulumi.String("example_device_type_installed"),
ManufacturerId: exampleManufacturer.ManufacturerId,
UHeight: pulumi.Float64(0),
SubdeviceRole: pulumi.String("child"),
})
if err != nil {
return err
}
exampleDeviceRole, err := netbox.NewDeviceRole(ctx, "exampleDeviceRole", &netbox.DeviceRoleArgs{
ColorHex: pulumi.String("123456"),
})
if err != nil {
return err
}
exampleDevice, err := netbox.NewDevice(ctx, "exampleDevice", &netbox.DeviceArgs{
DeviceTypeId: exampleDeviceType.DeviceTypeId,
TenantId: exampleTenant.TenantId,
RoleId: exampleDeviceRole.DeviceRoleId,
SiteId: exampleSite.SiteId,
})
if err != nil {
return err
}
exampleInstalledDevice, err := netbox.NewDevice(ctx, "exampleInstalledDevice", &netbox.DeviceArgs{
DeviceTypeId: exampleInstalledDeviceType.DeviceTypeId,
TenantId: exampleTenant.TenantId,
RoleId: exampleDeviceRole.DeviceRoleId,
SiteId: exampleSite.SiteId,
})
if err != nil {
return err
}
_, err = netbox.NewDeviceBay(ctx, "exampleDeviceBay", &netbox.DeviceBayArgs{
DeviceId: exampleDevice.DeviceId,
Label: pulumi.String("example_label"),
Description: pulumi.String("example_description"),
InstalledDeviceId: exampleInstalledDevice.DeviceId,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Netbox = Pulumi.Netbox;
return await Deployment.RunAsync(() =>
{
var exampleTenant = new Netbox.Tenant("exampleTenant");
var exampleSite = new Netbox.Site("exampleSite", new()
{
Status = "active",
});
var exampleManufacturer = new Netbox.Manufacturer("exampleManufacturer");
var exampleDeviceType = new Netbox.DeviceType("exampleDeviceType", new()
{
Model = "example_device_type",
ManufacturerId = exampleManufacturer.ManufacturerId,
SubdeviceRole = "parent",
});
var exampleInstalledDeviceType = new Netbox.DeviceType("exampleInstalledDeviceType", new()
{
Model = "example_device_type_installed",
ManufacturerId = exampleManufacturer.ManufacturerId,
UHeight = 0,
SubdeviceRole = "child",
});
var exampleDeviceRole = new Netbox.DeviceRole("exampleDeviceRole", new()
{
ColorHex = "123456",
});
var exampleDevice = new Netbox.Device("exampleDevice", new()
{
DeviceTypeId = exampleDeviceType.DeviceTypeId,
TenantId = exampleTenant.TenantId,
RoleId = exampleDeviceRole.DeviceRoleId,
SiteId = exampleSite.SiteId,
});
var exampleInstalledDevice = new Netbox.Device("exampleInstalledDevice", new()
{
DeviceTypeId = exampleInstalledDeviceType.DeviceTypeId,
TenantId = exampleTenant.TenantId,
RoleId = exampleDeviceRole.DeviceRoleId,
SiteId = exampleSite.SiteId,
});
var exampleDeviceBay = new Netbox.DeviceBay("exampleDeviceBay", new()
{
DeviceId = exampleDevice.DeviceId,
Label = "example_label",
Description = "example_description",
InstalledDeviceId = exampleInstalledDevice.DeviceId,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netbox.Tenant;
import com.pulumi.netbox.Site;
import com.pulumi.netbox.SiteArgs;
import com.pulumi.netbox.Manufacturer;
import com.pulumi.netbox.DeviceType;
import com.pulumi.netbox.DeviceTypeArgs;
import com.pulumi.netbox.DeviceRole;
import com.pulumi.netbox.DeviceRoleArgs;
import com.pulumi.netbox.Device;
import com.pulumi.netbox.DeviceArgs;
import com.pulumi.netbox.DeviceBay;
import com.pulumi.netbox.DeviceBayArgs;
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) {
var exampleTenant = new Tenant("exampleTenant");
var exampleSite = new Site("exampleSite", SiteArgs.builder()
.status("active")
.build());
var exampleManufacturer = new Manufacturer("exampleManufacturer");
var exampleDeviceType = new DeviceType("exampleDeviceType", DeviceTypeArgs.builder()
.model("example_device_type")
.manufacturerId(exampleManufacturer.manufacturerId())
.subdeviceRole("parent")
.build());
var exampleInstalledDeviceType = new DeviceType("exampleInstalledDeviceType", DeviceTypeArgs.builder()
.model("example_device_type_installed")
.manufacturerId(exampleManufacturer.manufacturerId())
.uHeight(0)
.subdeviceRole("child")
.build());
var exampleDeviceRole = new DeviceRole("exampleDeviceRole", DeviceRoleArgs.builder()
.colorHex("123456")
.build());
var exampleDevice = new Device("exampleDevice", DeviceArgs.builder()
.deviceTypeId(exampleDeviceType.deviceTypeId())
.tenantId(exampleTenant.tenantId())
.roleId(exampleDeviceRole.deviceRoleId())
.siteId(exampleSite.siteId())
.build());
var exampleInstalledDevice = new Device("exampleInstalledDevice", DeviceArgs.builder()
.deviceTypeId(exampleInstalledDeviceType.deviceTypeId())
.tenantId(exampleTenant.tenantId())
.roleId(exampleDeviceRole.deviceRoleId())
.siteId(exampleSite.siteId())
.build());
var exampleDeviceBay = new DeviceBay("exampleDeviceBay", DeviceBayArgs.builder()
.deviceId(exampleDevice.deviceId())
.label("example_label")
.description("example_description")
.installedDeviceId(exampleInstalledDevice.deviceId())
.build());
}
}
resources:
exampleTenant:
type: netbox:Tenant
exampleSite:
type: netbox:Site
properties:
status: active
exampleManufacturer:
type: netbox:Manufacturer
exampleDeviceType:
type: netbox:DeviceType
properties:
model: example_device_type
manufacturerId: ${exampleManufacturer.manufacturerId}
subdeviceRole: parent
exampleInstalledDeviceType:
type: netbox:DeviceType
properties:
model: example_device_type_installed
manufacturerId: ${exampleManufacturer.manufacturerId}
uHeight: 0
subdeviceRole: child
exampleDeviceRole:
type: netbox:DeviceRole
properties:
colorHex: '123456'
exampleDevice:
type: netbox:Device
properties:
deviceTypeId: ${exampleDeviceType.deviceTypeId}
tenantId: ${exampleTenant.tenantId}
roleId: ${exampleDeviceRole.deviceRoleId}
siteId: ${exampleSite.siteId}
exampleInstalledDevice:
type: netbox:Device
properties:
deviceTypeId: ${exampleInstalledDeviceType.deviceTypeId}
tenantId: ${exampleTenant.tenantId}
roleId: ${exampleDeviceRole.deviceRoleId}
siteId: ${exampleSite.siteId}
exampleDeviceBay:
type: netbox:DeviceBay
properties:
deviceId: ${exampleDevice.deviceId}
label: example_label
description: example_description
installedDeviceId: ${exampleInstalledDevice.deviceId}
Create DeviceBay Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new DeviceBay(name: string, args: DeviceBayArgs, opts?: CustomResourceOptions);
@overload
def DeviceBay(resource_name: str,
args: DeviceBayArgs,
opts: Optional[ResourceOptions] = None)
@overload
def DeviceBay(resource_name: str,
opts: Optional[ResourceOptions] = None,
device_id: Optional[float] = None,
custom_fields: Optional[Mapping[str, str]] = None,
description: Optional[str] = None,
device_bay_id: Optional[str] = None,
installed_device_id: Optional[float] = None,
label: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[Sequence[str]] = None)
func NewDeviceBay(ctx *Context, name string, args DeviceBayArgs, opts ...ResourceOption) (*DeviceBay, error)
public DeviceBay(string name, DeviceBayArgs args, CustomResourceOptions? opts = null)
public DeviceBay(String name, DeviceBayArgs args)
public DeviceBay(String name, DeviceBayArgs args, CustomResourceOptions options)
type: netbox:DeviceBay
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args DeviceBayArgs
- 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 DeviceBayArgs
- 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 DeviceBayArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DeviceBayArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DeviceBayArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var deviceBayResource = new Netbox.DeviceBay("deviceBayResource", new()
{
DeviceId = 0,
CustomFields =
{
{ "string", "string" },
},
Description = "string",
DeviceBayId = "string",
InstalledDeviceId = 0,
Label = "string",
Name = "string",
Tags = new[]
{
"string",
},
});
example, err := netbox.NewDeviceBay(ctx, "deviceBayResource", &netbox.DeviceBayArgs{
DeviceId: pulumi.Float64(0),
CustomFields: pulumi.StringMap{
"string": pulumi.String("string"),
},
Description: pulumi.String("string"),
DeviceBayId: pulumi.String("string"),
InstalledDeviceId: pulumi.Float64(0),
Label: pulumi.String("string"),
Name: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
})
var deviceBayResource = new DeviceBay("deviceBayResource", DeviceBayArgs.builder()
.deviceId(0.0)
.customFields(Map.of("string", "string"))
.description("string")
.deviceBayId("string")
.installedDeviceId(0.0)
.label("string")
.name("string")
.tags("string")
.build());
device_bay_resource = netbox.DeviceBay("deviceBayResource",
device_id=0,
custom_fields={
"string": "string",
},
description="string",
device_bay_id="string",
installed_device_id=0,
label="string",
name="string",
tags=["string"])
const deviceBayResource = new netbox.DeviceBay("deviceBayResource", {
deviceId: 0,
customFields: {
string: "string",
},
description: "string",
deviceBayId: "string",
installedDeviceId: 0,
label: "string",
name: "string",
tags: ["string"],
});
type: netbox:DeviceBay
properties:
customFields:
string: string
description: string
deviceBayId: string
deviceId: 0
installedDeviceId: 0
label: string
name: string
tags:
- string
DeviceBay Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The DeviceBay resource accepts the following input properties:
- Device
Id double - Custom
Fields Dictionary<string, string> - Description string
- Device
Bay stringId - The ID of this resource.
- Installed
Device doubleId - Label string
- Name string
- List<string>
- Device
Id float64 - Custom
Fields map[string]string - Description string
- Device
Bay stringId - The ID of this resource.
- Installed
Device float64Id - Label string
- Name string
- []string
- device
Id Double - custom
Fields Map<String,String> - description String
- device
Bay StringId - The ID of this resource.
- installed
Device DoubleId - label String
- name String
- List<String>
- device
Id number - custom
Fields {[key: string]: string} - description string
- device
Bay stringId - The ID of this resource.
- installed
Device numberId - label string
- name string
- string[]
- device_
id float - custom_
fields Mapping[str, str] - description str
- device_
bay_ strid - The ID of this resource.
- installed_
device_ floatid - label str
- name str
- Sequence[str]
- device
Id Number - custom
Fields Map<String> - description String
- device
Bay StringId - The ID of this resource.
- installed
Device NumberId - label String
- name String
- List<String>
Outputs
All input properties are implicitly available as output properties. Additionally, the DeviceBay resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- List<string>
- Id string
- The provider-assigned unique ID for this managed resource.
- []string
- id String
- The provider-assigned unique ID for this managed resource.
- List<String>
- id string
- The provider-assigned unique ID for this managed resource.
- string[]
- id str
- The provider-assigned unique ID for this managed resource.
- Sequence[str]
- id String
- The provider-assigned unique ID for this managed resource.
- List<String>
Look up Existing DeviceBay Resource
Get an existing DeviceBay 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?: DeviceBayState, opts?: CustomResourceOptions): DeviceBay
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
custom_fields: Optional[Mapping[str, str]] = None,
description: Optional[str] = None,
device_bay_id: Optional[str] = None,
device_id: Optional[float] = None,
installed_device_id: Optional[float] = None,
label: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[Sequence[str]] = None,
tags_alls: Optional[Sequence[str]] = None) -> DeviceBay
func GetDeviceBay(ctx *Context, name string, id IDInput, state *DeviceBayState, opts ...ResourceOption) (*DeviceBay, error)
public static DeviceBay Get(string name, Input<string> id, DeviceBayState? state, CustomResourceOptions? opts = null)
public static DeviceBay get(String name, Output<String> id, DeviceBayState state, CustomResourceOptions options)
resources: _: type: netbox:DeviceBay get: id: ${id}
- 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.
- Custom
Fields Dictionary<string, string> - Description string
- Device
Bay stringId - The ID of this resource.
- Device
Id double - Installed
Device doubleId - Label string
- Name string
- List<string>
- List<string>
- Custom
Fields map[string]string - Description string
- Device
Bay stringId - The ID of this resource.
- Device
Id float64 - Installed
Device float64Id - Label string
- Name string
- []string
- []string
- custom
Fields Map<String,String> - description String
- device
Bay StringId - The ID of this resource.
- device
Id Double - installed
Device DoubleId - label String
- name String
- List<String>
- List<String>
- custom
Fields {[key: string]: string} - description string
- device
Bay stringId - The ID of this resource.
- device
Id number - installed
Device numberId - label string
- name string
- string[]
- string[]
- custom_
fields Mapping[str, str] - description str
- device_
bay_ strid - The ID of this resource.
- device_
id float - installed_
device_ floatid - label str
- name str
- Sequence[str]
- Sequence[str]
- custom
Fields Map<String> - description String
- device
Bay StringId - The ID of this resource.
- device
Id Number - installed
Device NumberId - label String
- name String
- List<String>
- List<String>
Package Details
- Repository
- netbox e-breuninger/terraform-provider-netbox
- License
- Notes
- This Pulumi package is based on the
netbox
Terraform Provider.