1. Packages
  2. Harness
  3. API Docs
  4. AddUserToGroup
Harness v0.0.6 published on Saturday, Jul 1, 2023 by lbrlabs

harness.AddUserToGroup

Explore with Pulumi AI

harness logo
Harness v0.0.6 published on Saturday, Jul 1, 2023 by lbrlabs

    Resource for adding a user to a group.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Harness = Lbrlabs.PulumiPackage.Harness;
    using Harness = Pulumi.Harness;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleUser = Harness.GetUser.Invoke(new()
        {
            Email = "testuser@example.com",
        });
    
        var admin = new Harness.UserGroup("admin");
    
        var exampleAddUserToGroups = new Harness.AddUserToGroup("exampleAddUserToGroups", new()
        {
            GroupId = admin.Id,
            UserId = data.Harness_user.Test.Id,
        });
    
    });
    
    package main
    
    import (
    	"github.com/lbrlabs/pulumi-harness/sdk/go/harness"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := harness.LookupUser(ctx, &harness.LookupUserArgs{
    			Email: pulumi.StringRef("testuser@example.com"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		admin, err := harness.NewUserGroup(ctx, "admin", nil)
    		if err != nil {
    			return err
    		}
    		_, err = harness.NewAddUserToGroup(ctx, "exampleAddUserToGroups", &harness.AddUserToGroupArgs{
    			GroupId: admin.ID(),
    			UserId:  pulumi.Any(data.Harness_user.Test.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.harness.HarnessFunctions;
    import com.pulumi.harness.inputs.GetUserArgs;
    import com.pulumi.harness.UserGroup;
    import com.pulumi.harness.AddUserToGroup;
    import com.pulumi.harness.AddUserToGroupArgs;
    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) {
            final var exampleUser = HarnessFunctions.getUser(GetUserArgs.builder()
                .email("testuser@example.com")
                .build());
    
            var admin = new UserGroup("admin");
    
            var exampleAddUserToGroups = new AddUserToGroup("exampleAddUserToGroups", AddUserToGroupArgs.builder()        
                .groupId(admin.id())
                .userId(data.harness_user().test().id())
                .build());
    
        }
    }
    
    import pulumi
    import lbrlabs_pulumi_harness as harness
    import pulumi_harness as harness
    
    example_user = harness.get_user(email="testuser@example.com")
    admin = harness.UserGroup("admin")
    example_add_user_to_groups = harness.AddUserToGroup("exampleAddUserToGroups",
        group_id=admin.id,
        user_id=data["harness_user"]["test"]["id"])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as harness from "@lbrlabs/pulumi-harness";
    import * as harness from "@pulumi/harness";
    
    const exampleUser = harness.getUser({
        email: "testuser@example.com",
    });
    const admin = new harness.UserGroup("admin", {});
    const exampleAddUserToGroups = new harness.AddUserToGroup("exampleAddUserToGroups", {
        groupId: admin.id,
        userId: data.harness_user.test.id,
    });
    
    resources:
      admin:
        type: harness:UserGroup
      exampleAddUserToGroups:
        type: harness:AddUserToGroup
        properties:
          groupId: ${admin.id}
          userId: ${data.harness_user.test.id}
    variables:
      exampleUser:
        fn::invoke:
          Function: harness:getUser
          Arguments:
            email: testuser@example.com
    

    Create AddUserToGroup Resource

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

    Constructor syntax

    new AddUserToGroup(name: string, args: AddUserToGroupArgs, opts?: CustomResourceOptions);
    @overload
    def AddUserToGroup(resource_name: str,
                       args: AddUserToGroupArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def AddUserToGroup(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       group_id: Optional[str] = None,
                       user_id: Optional[str] = None)
    func NewAddUserToGroup(ctx *Context, name string, args AddUserToGroupArgs, opts ...ResourceOption) (*AddUserToGroup, error)
    public AddUserToGroup(string name, AddUserToGroupArgs args, CustomResourceOptions? opts = null)
    public AddUserToGroup(String name, AddUserToGroupArgs args)
    public AddUserToGroup(String name, AddUserToGroupArgs args, CustomResourceOptions options)
    
    type: harness:AddUserToGroup
    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 AddUserToGroupArgs
    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 AddUserToGroupArgs
    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 AddUserToGroupArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AddUserToGroupArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AddUserToGroupArgs
    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 addUserToGroupResource = new Harness.AddUserToGroup("addUserToGroupResource", new()
    {
        GroupId = "string",
        UserId = "string",
    });
    
    example, err := harness.NewAddUserToGroup(ctx, "addUserToGroupResource", &harness.AddUserToGroupArgs{
    	GroupId: pulumi.String("string"),
    	UserId:  pulumi.String("string"),
    })
    
    var addUserToGroupResource = new AddUserToGroup("addUserToGroupResource", AddUserToGroupArgs.builder()        
        .groupId("string")
        .userId("string")
        .build());
    
    add_user_to_group_resource = harness.AddUserToGroup("addUserToGroupResource",
        group_id="string",
        user_id="string")
    
    const addUserToGroupResource = new harness.AddUserToGroup("addUserToGroupResource", {
        groupId: "string",
        userId: "string",
    });
    
    type: harness:AddUserToGroup
    properties:
        groupId: string
        userId: string
    

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

    GroupId string
    The name of the user.
    UserId string
    Unique identifier of the user.
    GroupId string
    The name of the user.
    UserId string
    Unique identifier of the user.
    groupId String
    The name of the user.
    userId String
    Unique identifier of the user.
    groupId string
    The name of the user.
    userId string
    Unique identifier of the user.
    group_id str
    The name of the user.
    user_id str
    Unique identifier of the user.
    groupId String
    The name of the user.
    userId String
    Unique identifier of the user.

    Outputs

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

    Get an existing AddUserToGroup 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?: AddUserToGroupState, opts?: CustomResourceOptions): AddUserToGroup
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            group_id: Optional[str] = None,
            user_id: Optional[str] = None) -> AddUserToGroup
    func GetAddUserToGroup(ctx *Context, name string, id IDInput, state *AddUserToGroupState, opts ...ResourceOption) (*AddUserToGroup, error)
    public static AddUserToGroup Get(string name, Input<string> id, AddUserToGroupState? state, CustomResourceOptions? opts = null)
    public static AddUserToGroup get(String name, Output<String> id, AddUserToGroupState 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:
    GroupId string
    The name of the user.
    UserId string
    Unique identifier of the user.
    GroupId string
    The name of the user.
    UserId string
    Unique identifier of the user.
    groupId String
    The name of the user.
    userId String
    Unique identifier of the user.
    groupId string
    The name of the user.
    userId string
    Unique identifier of the user.
    group_id str
    The name of the user.
    user_id str
    Unique identifier of the user.
    groupId String
    The name of the user.
    userId String
    Unique identifier of the user.

    Import

    Import using the Harness user and user group id

     $ pulumi import harness:index/addUserToGroup:AddUserToGroup example_admin <user_id>/<group_id>
    

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

    Package Details

    Repository
    harness lbrlabs/pulumi-harness
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the harness Terraform Provider.
    harness logo
    Harness v0.0.6 published on Saturday, Jul 1, 2023 by lbrlabs