UNPKG

@natzka-oss/pulumi-netbox

Version:

A Pulumi package for creating and managing Netbox cloud resources.

167 lines (166 loc) 6.78 kB
import * as pulumi from "@pulumi/pulumi"; /** * This resource manages the object-based permissions for Netbox users, built into the application. * * > Object-based permissions enable an administrator to grant users or groups the ability to perform an action on arbitrary subsets of objects in NetBox, rather than all objects of a certain type. * For more information, see the [Netbox Object-Based Permissions Docs.](https://docs.netbox.dev/en/stable/administration/permissions/) * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as netbox from "@natzka-oss/pulumi-netbox"; * * const test = new netbox.auth.User("test", { * username: "johndoe", * password: "Abcdefghijkl1", * active: true, * staff: true, * }); * const testPermission = new netbox.auth.Permission("test", { * name: "test", * description: "my description", * enabled: true, * objectTypes: ["ipam.prefix"], * actions: [ * "add", * "change", * ], * users: [test.id], * constraints: JSON.stringify([{ * status: "active", * }]), * }); * ``` */ export declare class Permission extends pulumi.CustomResource { /** * Get an existing Permission 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?: PermissionState, opts?: pulumi.CustomResourceOptions): Permission; /** * Returns true if the given object is an instance of Permission. 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 Permission; /** * A list actions that are allowed on the object types. Acceptable values are `view`, `add`, `change`, or `delete`. */ readonly actions: pulumi.Output<string[]>; /** * A JSON string of an arbitrary filter used to limit the granted action(s) to a specific subset of objects. For more information on correct syntax, see https://docs.netbox.dev/en/stable/administration/permissions/#constraints. */ readonly constraints: pulumi.Output<string | undefined>; /** * The description of the permission object. */ readonly description: pulumi.Output<string | undefined>; /** * Whether the permission object is enabled or not. Defaults to `true`. */ readonly enabled: pulumi.Output<boolean | undefined>; /** * A list of group IDs that have been assigned to this permission object. */ readonly groups: pulumi.Output<number[] | undefined>; /** * The name of the permission object. */ readonly name: pulumi.Output<string>; /** * A list of object types that the permission object allows access to. Should be in a form the API can accept. For example: `circuits.provider`, `dcim.inventoryitem`, etc. */ readonly objectTypes: pulumi.Output<string[]>; /** * A list of user IDs that have been assigned to this permission object. */ readonly users: pulumi.Output<number[] | undefined>; /** * Create a Permission 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: PermissionArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Permission resources. */ export interface PermissionState { /** * A list actions that are allowed on the object types. Acceptable values are `view`, `add`, `change`, or `delete`. */ actions?: pulumi.Input<pulumi.Input<string>[]>; /** * A JSON string of an arbitrary filter used to limit the granted action(s) to a specific subset of objects. For more information on correct syntax, see https://docs.netbox.dev/en/stable/administration/permissions/#constraints. */ constraints?: pulumi.Input<string>; /** * The description of the permission object. */ description?: pulumi.Input<string>; /** * Whether the permission object is enabled or not. Defaults to `true`. */ enabled?: pulumi.Input<boolean>; /** * A list of group IDs that have been assigned to this permission object. */ groups?: pulumi.Input<pulumi.Input<number>[]>; /** * The name of the permission object. */ name?: pulumi.Input<string>; /** * A list of object types that the permission object allows access to. Should be in a form the API can accept. For example: `circuits.provider`, `dcim.inventoryitem`, etc. */ objectTypes?: pulumi.Input<pulumi.Input<string>[]>; /** * A list of user IDs that have been assigned to this permission object. */ users?: pulumi.Input<pulumi.Input<number>[]>; } /** * The set of arguments for constructing a Permission resource. */ export interface PermissionArgs { /** * A list actions that are allowed on the object types. Acceptable values are `view`, `add`, `change`, or `delete`. */ actions: pulumi.Input<pulumi.Input<string>[]>; /** * A JSON string of an arbitrary filter used to limit the granted action(s) to a specific subset of objects. For more information on correct syntax, see https://docs.netbox.dev/en/stable/administration/permissions/#constraints. */ constraints?: pulumi.Input<string>; /** * The description of the permission object. */ description?: pulumi.Input<string>; /** * Whether the permission object is enabled or not. Defaults to `true`. */ enabled?: pulumi.Input<boolean>; /** * A list of group IDs that have been assigned to this permission object. */ groups?: pulumi.Input<pulumi.Input<number>[]>; /** * The name of the permission object. */ name?: pulumi.Input<string>; /** * A list of object types that the permission object allows access to. Should be in a form the API can accept. For example: `circuits.provider`, `dcim.inventoryitem`, etc. */ objectTypes: pulumi.Input<pulumi.Input<string>[]>; /** * A list of user IDs that have been assigned to this permission object. */ users?: pulumi.Input<pulumi.Input<number>[]>; }