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

pagerduty.getLicenses

Explore with Pulumi AI

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

    Use this data source to get information about the purchased licenses that you can use for other managing PagerDuty user resources. To reference a unique license, see pagerduty.getLicense data source. After applying changes to users’ licenses, the current_value and allocations_available attributes of licenses will change.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as pagerduty from "@pulumi/pagerduty";
    
    const invalidRoles = ["owner"];
    const licenses = pagerduty.getLicenses({});
    const example = new pagerduty.User("example", {
        name: "Earline Greenholt",
        email: "125.greenholt.earline@graham.name",
        license: licenses.then(licenses => licenses.licenses?.[0]?.id),
        role: "user",
    });
    
    import pulumi
    import pulumi_pagerduty as pagerduty
    
    invalid_roles = ["owner"]
    licenses = pagerduty.get_licenses()
    example = pagerduty.User("example",
        name="Earline Greenholt",
        email="125.greenholt.earline@graham.name",
        license=licenses.licenses[0].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",
    		}
    		licenses, err := pagerduty.GetLicenses(ctx, &pagerduty.GetLicensesArgs{}, 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(licenses.Licenses[0].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 licenses = Pagerduty.GetLicenses.Invoke();
    
        var example = new Pagerduty.User("example", new()
        {
            Name = "Earline Greenholt",
            Email = "125.greenholt.earline@graham.name",
            License = licenses.Apply(getLicensesResult => getLicensesResult.Licenses[0]?.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.GetLicensesArgs;
    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 licenses = PagerdutyFunctions.getLicenses();
    
            var example = new User("example", UserArgs.builder()
                .name("Earline Greenholt")
                .email("125.greenholt.earline@graham.name")
                .license(licenses.applyValue(getLicensesResult -> getLicensesResult.licenses()[0].id()))
                .role("user")
                .build());
    
        }
    }
    
    resources:
      example:
        type: pagerduty:User
        properties:
          name: Earline Greenholt
          email: 125.greenholt.earline@graham.name
          license: ${licenses.licenses[0].id}
          role: user
    variables:
      invalidRoles:
        - owner
      licenses:
        fn::invoke:
          Function: pagerduty:getLicenses
          Arguments: {}
    

    Using getLicenses

    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 getLicenses(args: GetLicensesArgs, opts?: InvokeOptions): Promise<GetLicensesResult>
    function getLicensesOutput(args: GetLicensesOutputArgs, opts?: InvokeOptions): Output<GetLicensesResult>
    def get_licenses(id: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetLicensesResult
    def get_licenses_output(id: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetLicensesResult]
    func GetLicenses(ctx *Context, args *GetLicensesArgs, opts ...InvokeOption) (*GetLicensesResult, error)
    func GetLicensesOutput(ctx *Context, args *GetLicensesOutputArgs, opts ...InvokeOption) GetLicensesResultOutput

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

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

    The following arguments are supported:

    Id string
    Allows to override the default behavior for setting the id attribute that is required for data sources.
    Id string
    Allows to override the default behavior for setting the id attribute that is required for data sources.
    id String
    Allows to override the default behavior for setting the id attribute that is required for data sources.
    id string
    Allows to override the default behavior for setting the id attribute that is required for data sources.
    id str
    Allows to override the default behavior for setting the id attribute that is required for data sources.
    id String
    Allows to override the default behavior for setting the id attribute that is required for data sources.

    getLicenses Result

    The following output properties are available:

    Licenses List<GetLicensesLicense>
    The list of purchased licenses.
    Id string
    ID of the license
    Licenses []GetLicensesLicense
    The list of purchased licenses.
    Id string
    ID of the license
    licenses List<GetLicensesLicense>
    The list of purchased licenses.
    id String
    ID of the license
    licenses GetLicensesLicense[]
    The list of purchased licenses.
    id string
    ID of the license
    licenses Sequence[GetLicensesLicense]
    The list of purchased licenses.
    id str
    ID of the license
    licenses List<Property Map>
    The list of purchased licenses.
    id String
    ID of the license

    Supporting Types

    GetLicensesLicense

    AllocationsAvailable int
    Available allocations to assign to users
    CurrentValue int
    The number of allocations already assigned to users
    Description string
    Description of the license
    HtmlUrl string
    Id string
    Allows to override the default behavior for setting the id attribute that is required for data sources.
    Name string
    Name of the license
    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
    Description of the license
    HtmlUrl string
    Id string
    Allows to override the default behavior for setting the id attribute that is required for data sources.
    Name string
    Name of the license
    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
    Description of the license
    htmlUrl String
    id String
    Allows to override the default behavior for setting the id attribute that is required for data sources.
    name String
    Name of the license
    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
    Description of the license
    htmlUrl string
    id string
    Allows to override the default behavior for setting the id attribute that is required for data sources.
    name string
    Name of the license
    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
    Description of the license
    html_url str
    id str
    Allows to override the default behavior for setting the id attribute that is required for data sources.
    name str
    Name of the license
    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
    Description of the license
    htmlUrl String
    id String
    Allows to override the default behavior for setting the id attribute that is required for data sources.
    name String
    Name of the license
    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