1. Packages
  2. Harness Provider
  3. API Docs
  4. AddUserToGroup
Harness v0.4.4 published on Tuesday, Nov 12, 2024 by Pulumi

harness.AddUserToGroup

Explore with Pulumi AI

harness logo
Harness v0.4.4 published on Tuesday, Nov 12, 2024 by Pulumi

    Resource for adding a user to a group.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as harness from "@pulumi/harness";
    
    const exampleUser = harness.getUser({
        email: "testuser@example.com",
    });
    const admin = new harness.UserGroup("admin", {name: "admin"});
    const exampleAddUserToGroups = new harness.AddUserToGroup("example_add_user_to_groups", {
        groupId: admin.id,
        userId: test.id,
    });
    
    import pulumi
    import pulumi_harness as harness
    
    example_user = harness.get_user(email="testuser@example.com")
    admin = harness.UserGroup("admin", name="admin")
    example_add_user_to_groups = harness.AddUserToGroup("example_add_user_to_groups",
        group_id=admin.id,
        user_id=test["id"])
    
    package main
    
    import (
    	"github.com/pulumi/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", &harness.UserGroupArgs{
    			Name: pulumi.String("admin"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = harness.NewAddUserToGroup(ctx, "example_add_user_to_groups", &harness.AddUserToGroupArgs{
    			GroupId: admin.ID(),
    			UserId:  pulumi.Any(test.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Harness = Pulumi.Harness;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleUser = Harness.GetUser.Invoke(new()
        {
            Email = "testuser@example.com",
        });
    
        var admin = new Harness.UserGroup("admin", new()
        {
            Name = "admin",
        });
    
        var exampleAddUserToGroups = new Harness.AddUserToGroup("example_add_user_to_groups", new()
        {
            GroupId = admin.Id,
            UserId = test.Id,
        });
    
    });
    
    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.UserGroupArgs;
    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", UserGroupArgs.builder()
                .name("admin")
                .build());
    
            var exampleAddUserToGroups = new AddUserToGroup("exampleAddUserToGroups", AddUserToGroupArgs.builder()
                .groupId(admin.id())
                .userId(test.id())
                .build());
    
        }
    }
    
    resources:
      admin:
        type: harness:UserGroup
        properties:
          name: admin
      exampleAddUserToGroups:
        type: harness:AddUserToGroup
        name: example_add_user_to_groups
        properties:
          groupId: ${admin.id}
          userId: ${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.

    Constructor 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

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    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 pulumi/pulumi-harness
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the harness Terraform Provider.
    harness logo
    Harness v0.4.4 published on Tuesday, Nov 12, 2024 by Pulumi