1. Packages
  2. GitHub
  3. API Docs
  4. getAppToken
GitHub v5.17.0 published on Tuesday, Aug 29, 2023 by Pulumi

github.getAppToken

Explore with Pulumi AI

github logo
GitHub v5.17.0 published on Tuesday, Aug 29, 2023 by Pulumi

    Use this data source to generate a GitHub App JWT.

    Example Usage

    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        var @this = Github.GetAppToken.Invoke(new()
        {
            AppId = "123456",
            InstallationId = "78910",
            PemFile = File.ReadAllText("foo/bar.pem"),
        });
    
    });
    
    package main
    
    import (
    	"os"
    
    	"github.com/pulumi/pulumi-github/sdk/v5/go/github"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func readFileOrPanic(path string) pulumi.StringPtrInput {
    	data, err := os.ReadFile(path)
    	if err != nil {
    		panic(err.Error())
    	}
    	return pulumi.String(string(data))
    }
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := github.GetAppToken(ctx, &github.GetAppTokenArgs{
    			AppId:          "123456",
    			InstallationId: "78910",
    			PemFile:        readFileOrPanic("foo/bar.pem"),
    		}, nil)
    		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.github.GithubFunctions;
    import com.pulumi.github.inputs.GetAppTokenArgs;
    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 this = GithubFunctions.getAppToken(GetAppTokenArgs.builder()
                .appId("123456")
                .installationId("78910")
                .pemFile(Files.readString(Paths.get("foo/bar.pem")))
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_github as github
    
    this = github.get_app_token(app_id="123456",
        installation_id="78910",
        pem_file=(lambda path: open(path).read())("foo/bar.pem"))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as fs from "fs";
    import * as github from "@pulumi/github";
    
    const this = github.getAppToken({
        appId: "123456",
        installationId: "78910",
        pemFile: fs.readFileSync("foo/bar.pem"),
    });
    
    variables:
      this:
        fn::invoke:
          Function: github:getAppToken
          Arguments:
            appId: '123456'
            installationId: '78910'
            pemFile:
              fn::readFile: foo/bar.pem
    

    Using getAppToken

    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 getAppToken(args: GetAppTokenArgs, opts?: InvokeOptions): Promise<GetAppTokenResult>
    function getAppTokenOutput(args: GetAppTokenOutputArgs, opts?: InvokeOptions): Output<GetAppTokenResult>
    def get_app_token(app_id: Optional[str] = None,
                      installation_id: Optional[str] = None,
                      pem_file: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetAppTokenResult
    def get_app_token_output(app_id: Optional[pulumi.Input[str]] = None,
                      installation_id: Optional[pulumi.Input[str]] = None,
                      pem_file: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetAppTokenResult]
    func GetAppToken(ctx *Context, args *GetAppTokenArgs, opts ...InvokeOption) (*GetAppTokenResult, error)
    func GetAppTokenOutput(ctx *Context, args *GetAppTokenOutputArgs, opts ...InvokeOption) GetAppTokenResultOutput

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

    public static class GetAppToken 
    {
        public static Task<GetAppTokenResult> InvokeAsync(GetAppTokenArgs args, InvokeOptions? opts = null)
        public static Output<GetAppTokenResult> Invoke(GetAppTokenInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAppTokenResult> getAppToken(GetAppTokenArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: github:index/getAppToken:getAppToken
      arguments:
        # arguments dictionary

    The following arguments are supported:

    AppId string

    This is the ID of the GitHub App.

    InstallationId string

    This is the ID of the GitHub App installation.

    PemFile string

    This is the contents of the GitHub App private key PEM file.

    AppId string

    This is the ID of the GitHub App.

    InstallationId string

    This is the ID of the GitHub App installation.

    PemFile string

    This is the contents of the GitHub App private key PEM file.

    appId String

    This is the ID of the GitHub App.

    installationId String

    This is the ID of the GitHub App installation.

    pemFile String

    This is the contents of the GitHub App private key PEM file.

    appId string

    This is the ID of the GitHub App.

    installationId string

    This is the ID of the GitHub App installation.

    pemFile string

    This is the contents of the GitHub App private key PEM file.

    app_id str

    This is the ID of the GitHub App.

    installation_id str

    This is the ID of the GitHub App installation.

    pem_file str

    This is the contents of the GitHub App private key PEM file.

    appId String

    This is the ID of the GitHub App.

    installationId String

    This is the ID of the GitHub App installation.

    pemFile String

    This is the contents of the GitHub App private key PEM file.

    getAppToken Result

    The following output properties are available:

    AppId string
    Id string

    The provider-assigned unique ID for this managed resource.

    InstallationId string
    PemFile string
    Token string

    The generated GitHub APP JWT.

    AppId string
    Id string

    The provider-assigned unique ID for this managed resource.

    InstallationId string
    PemFile string
    Token string

    The generated GitHub APP JWT.

    appId String
    id String

    The provider-assigned unique ID for this managed resource.

    installationId String
    pemFile String
    token String

    The generated GitHub APP JWT.

    appId string
    id string

    The provider-assigned unique ID for this managed resource.

    installationId string
    pemFile string
    token string

    The generated GitHub APP JWT.

    app_id str
    id str

    The provider-assigned unique ID for this managed resource.

    installation_id str
    pem_file str
    token str

    The generated GitHub APP JWT.

    appId String
    id String

    The provider-assigned unique ID for this managed resource.

    installationId String
    pemFile String
    token String

    The generated GitHub APP JWT.

    Package Details

    Repository
    GitHub pulumi/pulumi-github
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the github Terraform Provider.

    github logo
    GitHub v5.17.0 published on Tuesday, Aug 29, 2023 by Pulumi