1. Packages
  2. Pagerduty Provider
  3. API Docs
  4. getLicense
PagerDuty v4.17.0 published on Wednesday, Nov 20, 2024 by Pulumi

pagerduty.getLicense

Explore with Pulumi AI

pagerduty logo
PagerDuty v4.17.0 published on Wednesday, Nov 20, 2024 by Pulumi

    Use this data source to use a single purchased license to manage PagerDuty user resources. After applying changes to users’ licenses, the current_value and allocations_available attributes of licenses will change.

    It is preferred to set the name and description to their exact values or to set the id. However, this will require updating your configuration if the accounts products ever change. To avoid errors when account products change, you may set the name of a license to a valid substring such as "Full User" or "Stakeholder".

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as pagerduty from "@pulumi/pagerduty";
    
    const invalidRoles = ["owner"];
    const fullUser = pagerduty.getLicense({
        name: "Full User",
        description: "",
    });
    const example = new pagerduty.User("example", {
        name: "Earline Greenholt",
        email: "125.greenholt.earline@graham.name",
        license: fullUser.then(fullUser => fullUser.id),
        role: "user",
    });
    
    import pulumi
    import pulumi_pagerduty as pagerduty
    
    invalid_roles = ["owner"]
    full_user = pagerduty.get_license(name="Full User",
        description="")
    example = pagerduty.User("example",
        name="Earline Greenholt",
        email="125.greenholt.earline@graham.name",
        license=full_user.id,
        role="user")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-pagerduty/sdk/v4/go/pagerduty"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_ := []string{
    			"owner",
    		}
    		fullUser, err := pagerduty.GetLicense(ctx, &pagerduty.GetLicenseArgs{
    			Name:        pulumi.StringRef("Full User"),
    			Description: pulumi.StringRef(""),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = pagerduty.NewUser(ctx, "example", &pagerduty.UserArgs{
    			Name:    pulumi.String("Earline Greenholt"),
    			Email:   pulumi.String("125.greenholt.earline@graham.name"),
    			License: pulumi.String(fullUser.Id),
    			Role:    pulumi.String("user"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Pagerduty = Pulumi.Pagerduty;
    
    return await Deployment.RunAsync(() => 
    {
        var invalidRoles = new[]
        {
            "owner",
        };
    
        var fullUser = Pagerduty.GetLicense.Invoke(new()
        {
            Name = "Full User",
            Description = "",
        });
    
        var example = new Pagerduty.User("example", new()
        {
            Name = "Earline Greenholt",
            Email = "125.greenholt.earline@graham.name",
            License = fullUser.Apply(getLicenseResult => getLicenseResult.Id),
            Role = "user",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.pagerduty.PagerdutyFunctions;
    import com.pulumi.pagerduty.inputs.GetLicenseArgs;
    import com.pulumi.pagerduty.User;
    import com.pulumi.pagerduty.UserArgs;
    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 invalidRoles = "owner";
    
            final var fullUser = PagerdutyFunctions.getLicense(GetLicenseArgs.builder()
                .name("Full User")
                .description("")
                .build());
    
            var example = new User("example", UserArgs.builder()
                .name("Earline Greenholt")
                .email("125.greenholt.earline@graham.name")
                .license(fullUser.applyValue(getLicenseResult -> getLicenseResult.id()))
                .role("user")
                .build());
    
        }
    }
    
    resources:
      example:
        type: pagerduty:User
        properties:
          name: Earline Greenholt
          email: 125.greenholt.earline@graham.name
          license: ${fullUser.id}
          role: user
    variables:
      invalidRoles:
        - owner
      fullUser:
        fn::invoke:
          Function: pagerduty:getLicense
          Arguments:
            name: Full User
            description:
    

    Using getLicense

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getLicense(args: GetLicenseArgs, opts?: InvokeOptions): Promise<GetLicenseResult>
    function getLicenseOutput(args: GetLicenseOutputArgs, opts?: InvokeOptions): Output<GetLicenseResult>
    def get_license(description: Optional[str] = None,
                    id: Optional[str] = None,
                    name: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetLicenseResult
    def get_license_output(description: Optional[pulumi.Input[str]] = None,
                    id: Optional[pulumi.Input[str]] = None,
                    name: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetLicenseResult]
    func GetLicense(ctx *Context, args *GetLicenseArgs, opts ...InvokeOption) (*GetLicenseResult, error)
    func GetLicenseOutput(ctx *Context, args *GetLicenseOutputArgs, opts ...InvokeOption) GetLicenseResultOutput

    > Note: This function is named GetLicense in the Go SDK.

    public static class GetLicense 
    {
        public static Task<GetLicenseResult> InvokeAsync(GetLicenseArgs args, InvokeOptions? opts = null)
        public static Output<GetLicenseResult> Invoke(GetLicenseInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetLicenseResult> getLicense(GetLicenseArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: pagerduty:index/getLicense:getLicense
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Description string
    Used to determine if the data config description is a valid substring of a valid license description assigned to the account.
    Id string
    Used to match the data config id with an exact match of a valid license ID assigned to the account.
    Name string
    Used to determine if the data config name is a valid substring of a valid license name assigned to the account.
    Description string
    Used to determine if the data config description is a valid substring of a valid license description assigned to the account.
    Id string
    Used to match the data config id with an exact match of a valid license ID assigned to the account.
    Name string
    Used to determine if the data config name is a valid substring of a valid license name assigned to the account.
    description String
    Used to determine if the data config description is a valid substring of a valid license description assigned to the account.
    id String
    Used to match the data config id with an exact match of a valid license ID assigned to the account.
    name String
    Used to determine if the data config name is a valid substring of a valid license name assigned to the account.
    description string
    Used to determine if the data config description is a valid substring of a valid license description assigned to the account.
    id string
    Used to match the data config id with an exact match of a valid license ID assigned to the account.
    name string
    Used to determine if the data config name is a valid substring of a valid license name assigned to the account.
    description str
    Used to determine if the data config description is a valid substring of a valid license description assigned to the account.
    id str
    Used to match the data config id with an exact match of a valid license ID assigned to the account.
    name str
    Used to determine if the data config name is a valid substring of a valid license name assigned to the account.
    description String
    Used to determine if the data config description is a valid substring of a valid license description assigned to the account.
    id String
    Used to match the data config id with an exact match of a valid license ID assigned to the account.
    name String
    Used to determine if the data config name is a valid substring of a valid license name assigned to the account.

    getLicense Result

    The following output properties are available:

    AllocationsAvailable int
    Available allocations to assign to users
    CurrentValue int
    The number of allocations already assigned to users
    Description string
    HtmlUrl string
    Id string
    Name string
    RoleGroup string
    The role group for the license that determines the available valid_roles
    Self string
    Summary string
    Summary of the license
    Type string
    ValidRoles List<string>
    List of allowed roles that may be assigned to a user with this license
    AllocationsAvailable int
    Available allocations to assign to users
    CurrentValue int
    The number of allocations already assigned to users
    Description string
    HtmlUrl string
    Id string
    Name string
    RoleGroup string
    The role group for the license that determines the available valid_roles
    Self string
    Summary string
    Summary of the license
    Type string
    ValidRoles []string
    List of allowed roles that may be assigned to a user with this license
    allocationsAvailable Integer
    Available allocations to assign to users
    currentValue Integer
    The number of allocations already assigned to users
    description String
    htmlUrl String
    id String
    name String
    roleGroup String
    The role group for the license that determines the available valid_roles
    self String
    summary String
    Summary of the license
    type String
    validRoles List<String>
    List of allowed roles that may be assigned to a user with this license
    allocationsAvailable number
    Available allocations to assign to users
    currentValue number
    The number of allocations already assigned to users
    description string
    htmlUrl string
    id string
    name string
    roleGroup string
    The role group for the license that determines the available valid_roles
    self string
    summary string
    Summary of the license
    type string
    validRoles string[]
    List of allowed roles that may be assigned to a user with this license
    allocations_available int
    Available allocations to assign to users
    current_value int
    The number of allocations already assigned to users
    description str
    html_url str
    id str
    name str
    role_group str
    The role group for the license that determines the available valid_roles
    self str
    summary str
    Summary of the license
    type str
    valid_roles Sequence[str]
    List of allowed roles that may be assigned to a user with this license
    allocationsAvailable Number
    Available allocations to assign to users
    currentValue Number
    The number of allocations already assigned to users
    description String
    htmlUrl String
    id String
    name String
    roleGroup String
    The role group for the license that determines the available valid_roles
    self String
    summary String
    Summary of the license
    type String
    validRoles List<String>
    List of allowed roles that may be assigned to a user with this license

    Package Details

    Repository
    PagerDuty pulumi/pulumi-pagerduty
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the pagerduty Terraform Provider.
    pagerduty logo
    PagerDuty v4.17.0 published on Wednesday, Nov 20, 2024 by Pulumi