GitHub v6.2.2 published on Tuesday, Jun 18, 2024 by Pulumi
github.getRestApi
Explore with Pulumi AI
Use this data source to retrieve information about a GitHub resource through REST API.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const example = github.getRestApi({
endpoint: "repos/example_repo/git/refs/heads/main",
});
import pulumi
import pulumi_github as github
example = github.get_rest_api(endpoint="repos/example_repo/git/refs/heads/main")
package main
import (
"github.com/pulumi/pulumi-github/sdk/v6/go/github"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := github.GetRestApi(ctx, &github.GetRestApiArgs{
Endpoint: "repos/example_repo/git/refs/heads/main",
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var example = Github.GetRestApi.Invoke(new()
{
Endpoint = "repos/example_repo/git/refs/heads/main",
});
});
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.GetRestApiArgs;
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 example = GithubFunctions.getRestApi(GetRestApiArgs.builder()
.endpoint("repos/example_repo/git/refs/heads/main")
.build());
}
}
variables:
example:
fn::invoke:
Function: github:getRestApi
Arguments:
endpoint: repos/example_repo/git/refs/heads/main
Using getRestApi
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 getRestApi(args: GetRestApiArgs, opts?: InvokeOptions): Promise<GetRestApiResult>
function getRestApiOutput(args: GetRestApiOutputArgs, opts?: InvokeOptions): Output<GetRestApiResult>
def get_rest_api(endpoint: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetRestApiResult
def get_rest_api_output(endpoint: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetRestApiResult]
func GetRestApi(ctx *Context, args *GetRestApiArgs, opts ...InvokeOption) (*GetRestApiResult, error)
func GetRestApiOutput(ctx *Context, args *GetRestApiOutputArgs, opts ...InvokeOption) GetRestApiResultOutput
> Note: This function is named GetRestApi
in the Go SDK.
public static class GetRestApi
{
public static Task<GetRestApiResult> InvokeAsync(GetRestApiArgs args, InvokeOptions? opts = null)
public static Output<GetRestApiResult> Invoke(GetRestApiInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetRestApiResult> getRestApi(GetRestApiArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: github:index/getRestApi:getRestApi
arguments:
# arguments dictionary
The following arguments are supported:
- Endpoint string
- REST API endpoint to send the GET request to.
- Endpoint string
- REST API endpoint to send the GET request to.
- endpoint String
- REST API endpoint to send the GET request to.
- endpoint string
- REST API endpoint to send the GET request to.
- endpoint str
- REST API endpoint to send the GET request to.
- endpoint String
- REST API endpoint to send the GET request to.
getRestApi Result
The following output properties are available:
Package Details
- Repository
- GitHub pulumi/pulumi-github
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
github
Terraform Provider.