netbox.Cable
Explore with Pulumi AI
From the official documentation:
All connections between device components in NetBox are represented using cables. A cable represents a direct physical connection between two sets of endpoints (A and B), such as a console port and a patch panel port, or between two network interfaces.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as netbox from "@pulumi/netbox";
// assumes that the referenced console port resources exist
const test = new netbox.Cable("test", {
aTerminations: [
{
objectType: "dcim.consoleserverport",
objectId: netbox_device_console_server_port.kvm1.id,
},
{
objectType: "dcim.consoleserverport",
objectId: netbox_device_console_server_port.kvm2.id,
},
],
bTerminations: [
{
objectType: "dcim.consoleport",
objectId: netbox_device_console_port.server1.id,
},
{
objectType: "dcim.consoleport",
objectId: netbox_device_console_port.server2.id,
},
],
status: "connected",
label: "KVM cable",
type: "cat8",
colorHex: "123456",
length: 10,
lengthUnit: "m",
});
import pulumi
import pulumi_netbox as netbox
# assumes that the referenced console port resources exist
test = netbox.Cable("test",
a_terminations=[
{
"object_type": "dcim.consoleserverport",
"object_id": netbox_device_console_server_port["kvm1"]["id"],
},
{
"object_type": "dcim.consoleserverport",
"object_id": netbox_device_console_server_port["kvm2"]["id"],
},
],
b_terminations=[
{
"object_type": "dcim.consoleport",
"object_id": netbox_device_console_port["server1"]["id"],
},
{
"object_type": "dcim.consoleport",
"object_id": netbox_device_console_port["server2"]["id"],
},
],
status="connected",
label="KVM cable",
type="cat8",
color_hex="123456",
length=10,
length_unit="m")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v3/netbox"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// assumes that the referenced console port resources exist
_, err := netbox.NewCable(ctx, "test", &netbox.CableArgs{
ATerminations: netbox.CableATerminationArray{
&netbox.CableATerminationArgs{
ObjectType: pulumi.String("dcim.consoleserverport"),
ObjectId: pulumi.Any(netbox_device_console_server_port.Kvm1.Id),
},
&netbox.CableATerminationArgs{
ObjectType: pulumi.String("dcim.consoleserverport"),
ObjectId: pulumi.Any(netbox_device_console_server_port.Kvm2.Id),
},
},
BTerminations: netbox.CableBTerminationArray{
&netbox.CableBTerminationArgs{
ObjectType: pulumi.String("dcim.consoleport"),
ObjectId: pulumi.Any(netbox_device_console_port.Server1.Id),
},
&netbox.CableBTerminationArgs{
ObjectType: pulumi.String("dcim.consoleport"),
ObjectId: pulumi.Any(netbox_device_console_port.Server2.Id),
},
},
Status: pulumi.String("connected"),
Label: pulumi.String("KVM cable"),
Type: pulumi.String("cat8"),
ColorHex: pulumi.String("123456"),
Length: pulumi.Float64(10),
LengthUnit: pulumi.String("m"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Netbox = Pulumi.Netbox;
return await Deployment.RunAsync(() =>
{
// assumes that the referenced console port resources exist
var test = new Netbox.Cable("test", new()
{
ATerminations = new[]
{
new Netbox.Inputs.CableATerminationArgs
{
ObjectType = "dcim.consoleserverport",
ObjectId = netbox_device_console_server_port.Kvm1.Id,
},
new Netbox.Inputs.CableATerminationArgs
{
ObjectType = "dcim.consoleserverport",
ObjectId = netbox_device_console_server_port.Kvm2.Id,
},
},
BTerminations = new[]
{
new Netbox.Inputs.CableBTerminationArgs
{
ObjectType = "dcim.consoleport",
ObjectId = netbox_device_console_port.Server1.Id,
},
new Netbox.Inputs.CableBTerminationArgs
{
ObjectType = "dcim.consoleport",
ObjectId = netbox_device_console_port.Server2.Id,
},
},
Status = "connected",
Label = "KVM cable",
Type = "cat8",
ColorHex = "123456",
Length = 10,
LengthUnit = "m",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netbox.Cable;
import com.pulumi.netbox.CableArgs;
import com.pulumi.netbox.inputs.CableATerminationArgs;
import com.pulumi.netbox.inputs.CableBTerminationArgs;
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) {
// assumes that the referenced console port resources exist
var test = new Cable("test", CableArgs.builder()
.aTerminations(
CableATerminationArgs.builder()
.objectType("dcim.consoleserverport")
.objectId(netbox_device_console_server_port.kvm1().id())
.build(),
CableATerminationArgs.builder()
.objectType("dcim.consoleserverport")
.objectId(netbox_device_console_server_port.kvm2().id())
.build())
.bTerminations(
CableBTerminationArgs.builder()
.objectType("dcim.consoleport")
.objectId(netbox_device_console_port.server1().id())
.build(),
CableBTerminationArgs.builder()
.objectType("dcim.consoleport")
.objectId(netbox_device_console_port.server2().id())
.build())
.status("connected")
.label("KVM cable")
.type("cat8")
.colorHex("123456")
.length(10)
.lengthUnit("m")
.build());
}
}
resources:
# assumes that the referenced console port resources exist
test:
type: netbox:Cable
properties:
aTerminations:
- objectType: dcim.consoleserverport
objectId: ${netbox_device_console_server_port.kvm1.id}
- objectType: dcim.consoleserverport
objectId: ${netbox_device_console_server_port.kvm2.id}
bTerminations:
- objectType: dcim.consoleport
objectId: ${netbox_device_console_port.server1.id}
- objectType: dcim.consoleport
objectId: ${netbox_device_console_port.server2.id}
status: connected
label: KVM cable
type: cat8
colorHex: '123456'
length: 10
lengthUnit: m
Create Cable Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Cable(name: string, args: CableArgs, opts?: CustomResourceOptions);
@overload
def Cable(resource_name: str,
args: CableArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Cable(resource_name: str,
opts: Optional[ResourceOptions] = None,
a_terminations: Optional[Sequence[CableATerminationArgs]] = None,
b_terminations: Optional[Sequence[CableBTerminationArgs]] = None,
status: Optional[str] = None,
description: Optional[str] = None,
comments: Optional[str] = None,
custom_fields: Optional[Mapping[str, str]] = None,
color_hex: Optional[str] = None,
label: Optional[str] = None,
length: Optional[float] = None,
length_unit: Optional[str] = None,
cable_id: Optional[str] = None,
tags: Optional[Sequence[str]] = None,
tenant_id: Optional[float] = None,
type: Optional[str] = None)
func NewCable(ctx *Context, name string, args CableArgs, opts ...ResourceOption) (*Cable, error)
public Cable(string name, CableArgs args, CustomResourceOptions? opts = null)
type: netbox:Cable
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 CableArgs
- 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 CableArgs
- 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 CableArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CableArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CableArgs
- 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 cableResource = new Netbox.Cable("cableResource", new()
{
ATerminations = new[]
{
new Netbox.Inputs.CableATerminationArgs
{
ObjectId = 0,
ObjectType = "string",
},
},
BTerminations = new[]
{
new Netbox.Inputs.CableBTerminationArgs
{
ObjectId = 0,
ObjectType = "string",
},
},
Status = "string",
Description = "string",
Comments = "string",
CustomFields =
{
{ "string", "string" },
},
ColorHex = "string",
Label = "string",
Length = 0,
LengthUnit = "string",
CableId = "string",
Tags = new[]
{
"string",
},
TenantId = 0,
Type = "string",
});
example, err := netbox.NewCable(ctx, "cableResource", &netbox.CableArgs{
ATerminations: netbox.CableATerminationArray{
&netbox.CableATerminationArgs{
ObjectId: pulumi.Float64(0),
ObjectType: pulumi.String("string"),
},
},
BTerminations: netbox.CableBTerminationArray{
&netbox.CableBTerminationArgs{
ObjectId: pulumi.Float64(0),
ObjectType: pulumi.String("string"),
},
},
Status: pulumi.String("string"),
Description: pulumi.String("string"),
Comments: pulumi.String("string"),
CustomFields: pulumi.StringMap{
"string": pulumi.String("string"),
},
ColorHex: pulumi.String("string"),
Label: pulumi.String("string"),
Length: pulumi.Float64(0),
LengthUnit: pulumi.String("string"),
CableId: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
TenantId: pulumi.Float64(0),
Type: pulumi.String("string"),
})
var cableResource = new Cable("cableResource", CableArgs.builder()
.aTerminations(CableATerminationArgs.builder()
.objectId(0)
.objectType("string")
.build())
.bTerminations(CableBTerminationArgs.builder()
.objectId(0)
.objectType("string")
.build())
.status("string")
.description("string")
.comments("string")
.customFields(Map.of("string", "string"))
.colorHex("string")
.label("string")
.length(0)
.lengthUnit("string")
.cableId("string")
.tags("string")
.tenantId(0)
.type("string")
.build());
cable_resource = netbox.Cable("cableResource",
a_terminations=[{
"object_id": 0,
"object_type": "string",
}],
b_terminations=[{
"object_id": 0,
"object_type": "string",
}],
status="string",
description="string",
comments="string",
custom_fields={
"string": "string",
},
color_hex="string",
label="string",
length=0,
length_unit="string",
cable_id="string",
tags=["string"],
tenant_id=0,
type="string")
const cableResource = new netbox.Cable("cableResource", {
aTerminations: [{
objectId: 0,
objectType: "string",
}],
bTerminations: [{
objectId: 0,
objectType: "string",
}],
status: "string",
description: "string",
comments: "string",
customFields: {
string: "string",
},
colorHex: "string",
label: "string",
length: 0,
lengthUnit: "string",
cableId: "string",
tags: ["string"],
tenantId: 0,
type: "string",
});
type: netbox:Cable
properties:
aTerminations:
- objectId: 0
objectType: string
bTerminations:
- objectId: 0
objectType: string
cableId: string
colorHex: string
comments: string
customFields:
string: string
description: string
label: string
length: 0
lengthUnit: string
status: string
tags:
- string
tenantId: 0
type: string
Cable 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 Cable resource accepts the following input properties:
- ATerminations
List<Cable
ATermination> - BTerminations
List<Cable
BTermination> - Status string
- One of [connected, planned, decommissioning].
- Cable
Id string - The ID of this resource.
- Color
Hex string - Comments string
- Custom
Fields Dictionary<string, string> - Description string
- Label string
- Length double
- Length
Unit string - One of [km, m, cm, mi, ft, in]. Required when
length
is set. - List<string>
- Tenant
Id double - Type string
- One of [cat3, cat5, cat5e, cat6, cat6a, cat7, cat7a, cat8, dac-active, dac-passive, mrj21-trunk, coaxial, mmf, mmf-om1, mmf-om2, mmf-om3, mmf-om4, mmf-om5, smf, smf-os1, smf-os2, aoc, power].
- ATerminations
[]Cable
ATermination Args - BTerminations
[]Cable
BTermination Args - Status string
- One of [connected, planned, decommissioning].
- Cable
Id string - The ID of this resource.
- Color
Hex string - Comments string
- Custom
Fields map[string]string - Description string
- Label string
- Length float64
- Length
Unit string - One of [km, m, cm, mi, ft, in]. Required when
length
is set. - []string
- Tenant
Id float64 - Type string
- One of [cat3, cat5, cat5e, cat6, cat6a, cat7, cat7a, cat8, dac-active, dac-passive, mrj21-trunk, coaxial, mmf, mmf-om1, mmf-om2, mmf-om3, mmf-om4, mmf-om5, smf, smf-os1, smf-os2, aoc, power].
- a
Terminations List<CableATermination> - b
Terminations List<CableBTermination> - status String
- One of [connected, planned, decommissioning].
- cable
Id String - The ID of this resource.
- color
Hex String - comments String
- custom
Fields Map<String,String> - description String
- label String
- length Double
- length
Unit String - One of [km, m, cm, mi, ft, in]. Required when
length
is set. - List<String>
- tenant
Id Double - type String
- One of [cat3, cat5, cat5e, cat6, cat6a, cat7, cat7a, cat8, dac-active, dac-passive, mrj21-trunk, coaxial, mmf, mmf-om1, mmf-om2, mmf-om3, mmf-om4, mmf-om5, smf, smf-os1, smf-os2, aoc, power].
- a
Terminations CableATermination[] - b
Terminations CableBTermination[] - status string
- One of [connected, planned, decommissioning].
- cable
Id string - The ID of this resource.
- color
Hex string - comments string
- custom
Fields {[key: string]: string} - description string
- label string
- length number
- length
Unit string - One of [km, m, cm, mi, ft, in]. Required when
length
is set. - string[]
- tenant
Id number - type string
- One of [cat3, cat5, cat5e, cat6, cat6a, cat7, cat7a, cat8, dac-active, dac-passive, mrj21-trunk, coaxial, mmf, mmf-om1, mmf-om2, mmf-om3, mmf-om4, mmf-om5, smf, smf-os1, smf-os2, aoc, power].
- a_
terminations Sequence[CableATermination Args] - b_
terminations Sequence[CableBTermination Args] - status str
- One of [connected, planned, decommissioning].
- cable_
id str - The ID of this resource.
- color_
hex str - comments str
- custom_
fields Mapping[str, str] - description str
- label str
- length float
- length_
unit str - One of [km, m, cm, mi, ft, in]. Required when
length
is set. - Sequence[str]
- tenant_
id float - type str
- One of [cat3, cat5, cat5e, cat6, cat6a, cat7, cat7a, cat8, dac-active, dac-passive, mrj21-trunk, coaxial, mmf, mmf-om1, mmf-om2, mmf-om3, mmf-om4, mmf-om5, smf, smf-os1, smf-os2, aoc, power].
- a
Terminations List<Property Map> - b
Terminations List<Property Map> - status String
- One of [connected, planned, decommissioning].
- cable
Id String - The ID of this resource.
- color
Hex String - comments String
- custom
Fields Map<String> - description String
- label String
- length Number
- length
Unit String - One of [km, m, cm, mi, ft, in]. Required when
length
is set. - List<String>
- tenant
Id Number - type String
- One of [cat3, cat5, cat5e, cat6, cat6a, cat7, cat7a, cat8, dac-active, dac-passive, mrj21-trunk, coaxial, mmf, mmf-om1, mmf-om2, mmf-om3, mmf-om4, mmf-om5, smf, smf-os1, smf-os2, aoc, power].
Outputs
All input properties are implicitly available as output properties. Additionally, the Cable resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Cable Resource
Get an existing Cable 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?: CableState, opts?: CustomResourceOptions): Cable
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
a_terminations: Optional[Sequence[CableATerminationArgs]] = None,
b_terminations: Optional[Sequence[CableBTerminationArgs]] = None,
cable_id: Optional[str] = None,
color_hex: Optional[str] = None,
comments: Optional[str] = None,
custom_fields: Optional[Mapping[str, str]] = None,
description: Optional[str] = None,
label: Optional[str] = None,
length: Optional[float] = None,
length_unit: Optional[str] = None,
status: Optional[str] = None,
tags: Optional[Sequence[str]] = None,
tenant_id: Optional[float] = None,
type: Optional[str] = None) -> Cable
func GetCable(ctx *Context, name string, id IDInput, state *CableState, opts ...ResourceOption) (*Cable, error)
public static Cable Get(string name, Input<string> id, CableState? state, CustomResourceOptions? opts = null)
public static Cable get(String name, Output<String> id, CableState state, CustomResourceOptions options)
resources: _: type: netbox:Cable 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.
- ATerminations
List<Cable
ATermination> - BTerminations
List<Cable
BTermination> - Cable
Id string - The ID of this resource.
- Color
Hex string - Comments string
- Custom
Fields Dictionary<string, string> - Description string
- Label string
- Length double
- Length
Unit string - One of [km, m, cm, mi, ft, in]. Required when
length
is set. - Status string
- One of [connected, planned, decommissioning].
- List<string>
- Tenant
Id double - Type string
- One of [cat3, cat5, cat5e, cat6, cat6a, cat7, cat7a, cat8, dac-active, dac-passive, mrj21-trunk, coaxial, mmf, mmf-om1, mmf-om2, mmf-om3, mmf-om4, mmf-om5, smf, smf-os1, smf-os2, aoc, power].
- ATerminations
[]Cable
ATermination Args - BTerminations
[]Cable
BTermination Args - Cable
Id string - The ID of this resource.
- Color
Hex string - Comments string
- Custom
Fields map[string]string - Description string
- Label string
- Length float64
- Length
Unit string - One of [km, m, cm, mi, ft, in]. Required when
length
is set. - Status string
- One of [connected, planned, decommissioning].
- []string
- Tenant
Id float64 - Type string
- One of [cat3, cat5, cat5e, cat6, cat6a, cat7, cat7a, cat8, dac-active, dac-passive, mrj21-trunk, coaxial, mmf, mmf-om1, mmf-om2, mmf-om3, mmf-om4, mmf-om5, smf, smf-os1, smf-os2, aoc, power].
- a
Terminations List<CableATermination> - b
Terminations List<CableBTermination> - cable
Id String - The ID of this resource.
- color
Hex String - comments String
- custom
Fields Map<String,String> - description String
- label String
- length Double
- length
Unit String - One of [km, m, cm, mi, ft, in]. Required when
length
is set. - status String
- One of [connected, planned, decommissioning].
- List<String>
- tenant
Id Double - type String
- One of [cat3, cat5, cat5e, cat6, cat6a, cat7, cat7a, cat8, dac-active, dac-passive, mrj21-trunk, coaxial, mmf, mmf-om1, mmf-om2, mmf-om3, mmf-om4, mmf-om5, smf, smf-os1, smf-os2, aoc, power].
- a
Terminations CableATermination[] - b
Terminations CableBTermination[] - cable
Id string - The ID of this resource.
- color
Hex string - comments string
- custom
Fields {[key: string]: string} - description string
- label string
- length number
- length
Unit string - One of [km, m, cm, mi, ft, in]. Required when
length
is set. - status string
- One of [connected, planned, decommissioning].
- string[]
- tenant
Id number - type string
- One of [cat3, cat5, cat5e, cat6, cat6a, cat7, cat7a, cat8, dac-active, dac-passive, mrj21-trunk, coaxial, mmf, mmf-om1, mmf-om2, mmf-om3, mmf-om4, mmf-om5, smf, smf-os1, smf-os2, aoc, power].
- a_
terminations Sequence[CableATermination Args] - b_
terminations Sequence[CableBTermination Args] - cable_
id str - The ID of this resource.
- color_
hex str - comments str
- custom_
fields Mapping[str, str] - description str
- label str
- length float
- length_
unit str - One of [km, m, cm, mi, ft, in]. Required when
length
is set. - status str
- One of [connected, planned, decommissioning].
- Sequence[str]
- tenant_
id float - type str
- One of [cat3, cat5, cat5e, cat6, cat6a, cat7, cat7a, cat8, dac-active, dac-passive, mrj21-trunk, coaxial, mmf, mmf-om1, mmf-om2, mmf-om3, mmf-om4, mmf-om5, smf, smf-os1, smf-os2, aoc, power].
- a
Terminations List<Property Map> - b
Terminations List<Property Map> - cable
Id String - The ID of this resource.
- color
Hex String - comments String
- custom
Fields Map<String> - description String
- label String
- length Number
- length
Unit String - One of [km, m, cm, mi, ft, in]. Required when
length
is set. - status String
- One of [connected, planned, decommissioning].
- List<String>
- tenant
Id Number - type String
- One of [cat3, cat5, cat5e, cat6, cat6a, cat7, cat7a, cat8, dac-active, dac-passive, mrj21-trunk, coaxial, mmf, mmf-om1, mmf-om2, mmf-om3, mmf-om4, mmf-om5, smf, smf-os1, smf-os2, aoc, power].
Supporting Types
CableATermination, CableATerminationArgs
- Object
Id double - Object
Type string
- Object
Id float64 - Object
Type string
- object
Id Double - object
Type String
- object
Id number - object
Type string
- object_
id float - object_
type str
- object
Id Number - object
Type String
CableBTermination, CableBTerminationArgs
- Object
Id double - Object
Type string
- Object
Id float64 - Object
Type string
- object
Id Double - object
Type String
- object
Id number - object
Type string
- object_
id float - object_
type str
- object
Id Number - object
Type String
Package Details
- Repository
- netbox e-breuninger/terraform-provider-netbox
- License
- Notes
- This Pulumi package is based on the
netbox
Terraform Provider.