1. Packages
  2. Netbox Provider
  3. API Docs
  4. ContactAssignment
netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger

netbox.ContactAssignment

Explore with Pulumi AI

netbox logo
netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger

    From the official documentation:

    Much like tenancy, contact assignment enables you to track ownership of resources modeled in NetBox.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netbox from "@pulumi/netbox";
    
    const testContact = new netbox.Contact("testContact", {});
    const testContactRole = new netbox.ContactRole("testContactRole", {});
    // Assumes that a device with id 123 exists
    const testContactAssignment = new netbox.ContactAssignment("testContactAssignment", {
        contentType: "dcim.device",
        objectId: 123,
        contactId: testContact.contactId,
        roleId: testContactRole.contactRoleId,
        priority: "primary",
    });
    
    import pulumi
    import pulumi_netbox as netbox
    
    test_contact = netbox.Contact("testContact")
    test_contact_role = netbox.ContactRole("testContactRole")
    # Assumes that a device with id 123 exists
    test_contact_assignment = netbox.ContactAssignment("testContactAssignment",
        content_type="dcim.device",
        object_id=123,
        contact_id=test_contact.contact_id,
        role_id=test_contact_role.contact_role_id,
        priority="primary")
    
    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 {
    		testContact, err := netbox.NewContact(ctx, "testContact", nil)
    		if err != nil {
    			return err
    		}
    		testContactRole, err := netbox.NewContactRole(ctx, "testContactRole", nil)
    		if err != nil {
    			return err
    		}
    		// Assumes that a device with id 123 exists
    		_, err = netbox.NewContactAssignment(ctx, "testContactAssignment", &netbox.ContactAssignmentArgs{
    			ContentType: pulumi.String("dcim.device"),
    			ObjectId:    pulumi.Float64(123),
    			ContactId:   testContact.ContactId,
    			RoleId:      testContactRole.ContactRoleId,
    			Priority:    pulumi.String("primary"),
    		})
    		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 testContact = new Netbox.Contact("testContact");
    
        var testContactRole = new Netbox.ContactRole("testContactRole");
    
        // Assumes that a device with id 123 exists
        var testContactAssignment = new Netbox.ContactAssignment("testContactAssignment", new()
        {
            ContentType = "dcim.device",
            ObjectId = 123,
            ContactId = testContact.ContactId,
            RoleId = testContactRole.ContactRoleId,
            Priority = "primary",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.netbox.Contact;
    import com.pulumi.netbox.ContactRole;
    import com.pulumi.netbox.ContactAssignment;
    import com.pulumi.netbox.ContactAssignmentArgs;
    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 testContact = new Contact("testContact");
    
            var testContactRole = new ContactRole("testContactRole");
    
            // Assumes that a device with id 123 exists
            var testContactAssignment = new ContactAssignment("testContactAssignment", ContactAssignmentArgs.builder()
                .contentType("dcim.device")
                .objectId(123)
                .contactId(testContact.contactId())
                .roleId(testContactRole.contactRoleId())
                .priority("primary")
                .build());
    
        }
    }
    
    resources:
      testContact:
        type: netbox:Contact
      testContactRole:
        type: netbox:ContactRole
      # Assumes that a device with id 123 exists
      testContactAssignment:
        type: netbox:ContactAssignment
        properties:
          contentType: dcim.device
          objectId: 123
          contactId: ${testContact.contactId}
          roleId: ${testContactRole.contactRoleId}
          priority: primary
    

    Create ContactAssignment Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ContactAssignment(name: string, args: ContactAssignmentArgs, opts?: CustomResourceOptions);
    @overload
    def ContactAssignment(resource_name: str,
                          args: ContactAssignmentArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def ContactAssignment(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          contact_id: Optional[float] = None,
                          content_type: Optional[str] = None,
                          object_id: Optional[float] = None,
                          role_id: Optional[float] = None,
                          contact_assignment_id: Optional[str] = None,
                          priority: Optional[str] = None)
    func NewContactAssignment(ctx *Context, name string, args ContactAssignmentArgs, opts ...ResourceOption) (*ContactAssignment, error)
    public ContactAssignment(string name, ContactAssignmentArgs args, CustomResourceOptions? opts = null)
    public ContactAssignment(String name, ContactAssignmentArgs args)
    public ContactAssignment(String name, ContactAssignmentArgs args, CustomResourceOptions options)
    
    type: netbox:ContactAssignment
    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 ContactAssignmentArgs
    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 ContactAssignmentArgs
    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 ContactAssignmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ContactAssignmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ContactAssignmentArgs
    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 contactAssignmentResource = new Netbox.ContactAssignment("contactAssignmentResource", new()
    {
        ContactId = 0,
        ContentType = "string",
        ObjectId = 0,
        RoleId = 0,
        ContactAssignmentId = "string",
        Priority = "string",
    });
    
    example, err := netbox.NewContactAssignment(ctx, "contactAssignmentResource", &netbox.ContactAssignmentArgs{
    	ContactId:           pulumi.Float64(0),
    	ContentType:         pulumi.String("string"),
    	ObjectId:            pulumi.Float64(0),
    	RoleId:              pulumi.Float64(0),
    	ContactAssignmentId: pulumi.String("string"),
    	Priority:            pulumi.String("string"),
    })
    
    var contactAssignmentResource = new ContactAssignment("contactAssignmentResource", ContactAssignmentArgs.builder()
        .contactId(0)
        .contentType("string")
        .objectId(0)
        .roleId(0)
        .contactAssignmentId("string")
        .priority("string")
        .build());
    
    contact_assignment_resource = netbox.ContactAssignment("contactAssignmentResource",
        contact_id=0,
        content_type="string",
        object_id=0,
        role_id=0,
        contact_assignment_id="string",
        priority="string")
    
    const contactAssignmentResource = new netbox.ContactAssignment("contactAssignmentResource", {
        contactId: 0,
        contentType: "string",
        objectId: 0,
        roleId: 0,
        contactAssignmentId: "string",
        priority: "string",
    });
    
    type: netbox:ContactAssignment
    properties:
        contactAssignmentId: string
        contactId: 0
        contentType: string
        objectId: 0
        priority: string
        roleId: 0
    

    ContactAssignment 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 ContactAssignment resource accepts the following input properties:

    ContactId double
    ContentType string
    ObjectId double
    RoleId double
    ContactAssignmentId string
    The ID of this resource.
    Priority string
    Valid values are primary, secondary, tertiary and inactive.
    ContactId float64
    ContentType string
    ObjectId float64
    RoleId float64
    ContactAssignmentId string
    The ID of this resource.
    Priority string
    Valid values are primary, secondary, tertiary and inactive.
    contactId Double
    contentType String
    objectId Double
    roleId Double
    contactAssignmentId String
    The ID of this resource.
    priority String
    Valid values are primary, secondary, tertiary and inactive.
    contactId number
    contentType string
    objectId number
    roleId number
    contactAssignmentId string
    The ID of this resource.
    priority string
    Valid values are primary, secondary, tertiary and inactive.
    contact_id float
    content_type str
    object_id float
    role_id float
    contact_assignment_id str
    The ID of this resource.
    priority str
    Valid values are primary, secondary, tertiary and inactive.
    contactId Number
    contentType String
    objectId Number
    roleId Number
    contactAssignmentId String
    The ID of this resource.
    priority String
    Valid values are primary, secondary, tertiary and inactive.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ContactAssignment 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 ContactAssignment Resource

    Get an existing ContactAssignment 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?: ContactAssignmentState, opts?: CustomResourceOptions): ContactAssignment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            contact_assignment_id: Optional[str] = None,
            contact_id: Optional[float] = None,
            content_type: Optional[str] = None,
            object_id: Optional[float] = None,
            priority: Optional[str] = None,
            role_id: Optional[float] = None) -> ContactAssignment
    func GetContactAssignment(ctx *Context, name string, id IDInput, state *ContactAssignmentState, opts ...ResourceOption) (*ContactAssignment, error)
    public static ContactAssignment Get(string name, Input<string> id, ContactAssignmentState? state, CustomResourceOptions? opts = null)
    public static ContactAssignment get(String name, Output<String> id, ContactAssignmentState state, CustomResourceOptions options)
    resources:  _:    type: netbox:ContactAssignment    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.
    The following state arguments are supported:
    ContactAssignmentId string
    The ID of this resource.
    ContactId double
    ContentType string
    ObjectId double
    Priority string
    Valid values are primary, secondary, tertiary and inactive.
    RoleId double
    ContactAssignmentId string
    The ID of this resource.
    ContactId float64
    ContentType string
    ObjectId float64
    Priority string
    Valid values are primary, secondary, tertiary and inactive.
    RoleId float64
    contactAssignmentId String
    The ID of this resource.
    contactId Double
    contentType String
    objectId Double
    priority String
    Valid values are primary, secondary, tertiary and inactive.
    roleId Double
    contactAssignmentId string
    The ID of this resource.
    contactId number
    contentType string
    objectId number
    priority string
    Valid values are primary, secondary, tertiary and inactive.
    roleId number
    contact_assignment_id str
    The ID of this resource.
    contact_id float
    content_type str
    object_id float
    priority str
    Valid values are primary, secondary, tertiary and inactive.
    role_id float
    contactAssignmentId String
    The ID of this resource.
    contactId Number
    contentType String
    objectId Number
    priority String
    Valid values are primary, secondary, tertiary and inactive.
    roleId Number

    Package Details

    Repository
    netbox e-breuninger/terraform-provider-netbox
    License
    Notes
    This Pulumi package is based on the netbox Terraform Provider.
    netbox logo
    netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger