@pulumiverse/harbor
Version:
A Pulumi package for creating and managing Harbor resources.
101 lines • 4.84 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.RobotAccount = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* ## Example Usage
*
* ### System Level
* Introduced in harbor 2.2.0, system level robot accounts can have basically [all available permissions](https://github.com/goharbor/harbor/blob/-/src/common/rbac/const.go) in harbor and are not dependent on a single project.
*
* ### Global
*
* The above example, creates a system level robot account with permissions to
* - permission to create labels on system level
* - pull repository across all projects
* - push repository to project "my-project-name"
*
* ### Project
*
* Other than system level robot accounts, project level robot accounts can interact on project level only.
* The [available permissions](https://github.com/goharbor/harbor/blob/-/src/common/rbac/const.go) are mostly the same as for system level robots.
*
* The above example creates a project level robot account with permissions to
* - pull repository on project "main"
* - push repository on project "main"
*
* ## Import
*
* ```sh
* $ pulumi import harbor:index/robotAccount:RobotAccount system /robots/123
* ```
*/
class RobotAccount extends pulumi.CustomResource {
/**
* Get an existing RobotAccount 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, id, state, opts) {
return new RobotAccount(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of RobotAccount. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === RobotAccount.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["disable"] = state ? state.disable : undefined;
resourceInputs["duration"] = state ? state.duration : undefined;
resourceInputs["fullName"] = state ? state.fullName : undefined;
resourceInputs["level"] = state ? state.level : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["permissions"] = state ? state.permissions : undefined;
resourceInputs["robotId"] = state ? state.robotId : undefined;
resourceInputs["secret"] = state ? state.secret : undefined;
}
else {
const args = argsOrState;
if ((!args || args.level === undefined) && !opts.urn) {
throw new Error("Missing required property 'level'");
}
if ((!args || args.permissions === undefined) && !opts.urn) {
throw new Error("Missing required property 'permissions'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["disable"] = args ? args.disable : undefined;
resourceInputs["duration"] = args ? args.duration : undefined;
resourceInputs["level"] = args ? args.level : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["permissions"] = args ? args.permissions : undefined;
resourceInputs["secret"] = (args === null || args === void 0 ? void 0 : args.secret) ? pulumi.secret(args.secret) : undefined;
resourceInputs["fullName"] = undefined /*out*/;
resourceInputs["robotId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["secret"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(RobotAccount.__pulumiType, name, resourceInputs, opts);
}
}
exports.RobotAccount = RobotAccount;
/** @internal */
RobotAccount.__pulumiType = 'harbor:index/robotAccount:RobotAccount';
//# sourceMappingURL=robotAccount.js.map