1. Packages
  2. Github Provider
  3. API Docs
  4. getRestApi
GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi

github.getRestApi

Explore with Pulumi AI

github logo
GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi

    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:

    Body string
    A JSON string containing response body.
    Code int
    A response status code.
    Endpoint string
    Headers string
    A JSON string containing response headers.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    A response status string.
    Body string
    A JSON string containing response body.
    Code int
    A response status code.
    Endpoint string
    Headers string
    A JSON string containing response headers.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    A response status string.
    body String
    A JSON string containing response body.
    code Integer
    A response status code.
    endpoint String
    headers String
    A JSON string containing response headers.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    A response status string.
    body string
    A JSON string containing response body.
    code number
    A response status code.
    endpoint string
    headers string
    A JSON string containing response headers.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    A response status string.
    body str
    A JSON string containing response body.
    code int
    A response status code.
    endpoint str
    headers str
    A JSON string containing response headers.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    A response status string.
    body String
    A JSON string containing response body.
    code Number
    A response status code.
    endpoint String
    headers String
    A JSON string containing response headers.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    A response status string.

    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 v6.3.2 published on Friday, Oct 11, 2024 by Pulumi