1. Packages
  2. Harbor
  3. API Docs
  4. RobotAccount
Harbor v3.10.8 published on Wednesday, Feb 14, 2024 by Pulumiverse

harbor.RobotAccount

Explore with Pulumi AI

harbor logo
Harbor v3.10.8 published on Wednesday, Feb 14, 2024 by Pulumiverse

    # Resource: harbor.RobotAccount

    Harbor supports different levels of robot accounts. Currently system and project level robot accounts are supported.

    Example Usage

    System Level

    Introduced in harbor 2.2.0, system level robot accounts can have basically all available permissions in harbor and are not dependent on a single project.

    resource "random_password" "password" {
      length  = 12
      special = false
    }
    
    resource "harbor_project" "main" {
        name = "main"
    }
    
    resource "harbor_robot_account" "system" {
      name        = "example-system"
      description = "system level robot account"
      level       = "system"
      secret      = resource.random_password.password.result
      permissions {
        access {
          action   = "create"
          resource = "labels"
        }
        kind      = "system"
        namespace = "/"
      }
      permissions {
        access {
          action   = "push"
          resource = "repository"
        }
        kind      = "project"
        namespace = harbor_project.main.name
      }
      permissions {
        access {
          action   = "pull"
          resource = "repository"
        }
        kind      = "project"
        namespace = "*"
      }
    }
    

    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 Level

    Other than system level robot accounts, project level robot accounts can interact on project level only. The available permissions are mostly the same as for system level robots.

    resource "harbor_project" "main" {
        name = "main"
    }
    
    resource "harbor_robot_account" "project" {
      name        = "example-project"
      description = "project level robot account"
      level       = "project"
      permissions {
        access {
          action   = "pull"
          resource = "repository"
        }
        access {
          action   = "push"
          resource = "repository"
        }
        kind      = "project"
        namespace = harbor_project.main.name
      }
    }
    

    The above example creates a project level robot account with permissions to

    • pull repository on project “main”
    • push repository on project “main”

    Create RobotAccount Resource

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

    Constructor syntax

    new RobotAccount(name: string, args: RobotAccountArgs, opts?: CustomResourceOptions);
    @overload
    def RobotAccount(resource_name: str,
                     args: RobotAccountArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def RobotAccount(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     level: Optional[str] = None,
                     permissions: Optional[Sequence[RobotAccountPermissionArgs]] = None,
                     description: Optional[str] = None,
                     disable: Optional[bool] = None,
                     duration: Optional[int] = None,
                     name: Optional[str] = None,
                     secret: Optional[str] = None)
    func NewRobotAccount(ctx *Context, name string, args RobotAccountArgs, opts ...ResourceOption) (*RobotAccount, error)
    public RobotAccount(string name, RobotAccountArgs args, CustomResourceOptions? opts = null)
    public RobotAccount(String name, RobotAccountArgs args)
    public RobotAccount(String name, RobotAccountArgs args, CustomResourceOptions options)
    
    type: harbor:RobotAccount
    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 RobotAccountArgs
    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 RobotAccountArgs
    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 RobotAccountArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RobotAccountArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RobotAccountArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var robotAccountResource = new Harbor.RobotAccount("robotAccountResource", new()
    {
        Level = "string",
        Permissions = new[]
        {
            new Harbor.Inputs.RobotAccountPermissionArgs
            {
                Accesses = new[]
                {
                    new Harbor.Inputs.RobotAccountPermissionAccessArgs
                    {
                        Action = "string",
                        Resource = "string",
                        Effect = "string",
                    },
                },
                Kind = "string",
                Namespace = "string",
            },
        },
        Description = "string",
        Disable = false,
        Duration = 0,
        Name = "string",
        Secret = "string",
    });
    
    example, err := harbor.NewRobotAccount(ctx, "robotAccountResource", &harbor.RobotAccountArgs{
    	Level: pulumi.String("string"),
    	Permissions: harbor.RobotAccountPermissionArray{
    		&harbor.RobotAccountPermissionArgs{
    			Accesses: harbor.RobotAccountPermissionAccessArray{
    				&harbor.RobotAccountPermissionAccessArgs{
    					Action:   pulumi.String("string"),
    					Resource: pulumi.String("string"),
    					Effect:   pulumi.String("string"),
    				},
    			},
    			Kind:      pulumi.String("string"),
    			Namespace: pulumi.String("string"),
    		},
    	},
    	Description: pulumi.String("string"),
    	Disable:     pulumi.Bool(false),
    	Duration:    pulumi.Int(0),
    	Name:        pulumi.String("string"),
    	Secret:      pulumi.String("string"),
    })
    
    var robotAccountResource = new RobotAccount("robotAccountResource", RobotAccountArgs.builder()        
        .level("string")
        .permissions(RobotAccountPermissionArgs.builder()
            .accesses(RobotAccountPermissionAccessArgs.builder()
                .action("string")
                .resource("string")
                .effect("string")
                .build())
            .kind("string")
            .namespace("string")
            .build())
        .description("string")
        .disable(false)
        .duration(0)
        .name("string")
        .secret("string")
        .build());
    
    robot_account_resource = harbor.RobotAccount("robotAccountResource",
        level="string",
        permissions=[harbor.RobotAccountPermissionArgs(
            accesses=[harbor.RobotAccountPermissionAccessArgs(
                action="string",
                resource="string",
                effect="string",
            )],
            kind="string",
            namespace="string",
        )],
        description="string",
        disable=False,
        duration=0,
        name="string",
        secret="string")
    
    const robotAccountResource = new harbor.RobotAccount("robotAccountResource", {
        level: "string",
        permissions: [{
            accesses: [{
                action: "string",
                resource: "string",
                effect: "string",
            }],
            kind: "string",
            namespace: "string",
        }],
        description: "string",
        disable: false,
        duration: 0,
        name: "string",
        secret: "string",
    });
    
    type: harbor:RobotAccount
    properties:
        description: string
        disable: false
        duration: 0
        level: string
        name: string
        permissions:
            - accesses:
                - action: string
                  effect: string
                  resource: string
              kind: string
              namespace: string
        secret: string
    

    RobotAccount Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The RobotAccount resource accepts the following input properties:

    Outputs

    All input properties are implicitly available as output properties. Additionally, the RobotAccount resource produces the following output properties:

    FullName string
    Id string
    The provider-assigned unique ID for this managed resource.
    RobotId string
    FullName string
    Id string
    The provider-assigned unique ID for this managed resource.
    RobotId string
    fullName String
    id String
    The provider-assigned unique ID for this managed resource.
    robotId String
    fullName string
    id string
    The provider-assigned unique ID for this managed resource.
    robotId string
    full_name str
    id str
    The provider-assigned unique ID for this managed resource.
    robot_id str
    fullName String
    id String
    The provider-assigned unique ID for this managed resource.
    robotId String

    Look up Existing RobotAccount Resource

    Get an existing RobotAccount 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?: RobotAccountState, opts?: CustomResourceOptions): RobotAccount
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            disable: Optional[bool] = None,
            duration: Optional[int] = None,
            full_name: Optional[str] = None,
            level: Optional[str] = None,
            name: Optional[str] = None,
            permissions: Optional[Sequence[RobotAccountPermissionArgs]] = None,
            robot_id: Optional[str] = None,
            secret: Optional[str] = None) -> RobotAccount
    func GetRobotAccount(ctx *Context, name string, id IDInput, state *RobotAccountState, opts ...ResourceOption) (*RobotAccount, error)
    public static RobotAccount Get(string name, Input<string> id, RobotAccountState? state, CustomResourceOptions? opts = null)
    public static RobotAccount get(String name, Output<String> id, RobotAccountState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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:
    description String
    disable Boolean
    duration Number
    fullName String
    level String
    name String
    permissions List<Property Map>
    robotId String
    secret String

    Supporting Types

    RobotAccountPermission, RobotAccountPermissionArgs

    RobotAccountPermissionAccess, RobotAccountPermissionAccessArgs

    Action string
    Resource string
    Effect string
    Action string
    Resource string
    Effect string
    action String
    resource String
    effect String
    action string
    resource string
    effect string
    action String
    resource String
    effect String

    Import

    Harbor robot account can be imported using the robot account id eg, <break><break> ```sh<break> $ pulumi import harbor:index/robotAccount:RobotAccount system /robots/123 <break>```<break><break>

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    harbor pulumiverse/pulumi-harbor
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the harbor Terraform Provider.
    harbor logo
    Harbor v3.10.8 published on Wednesday, Feb 14, 2024 by Pulumiverse