1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. getCallerIdentity
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.getCallerIdentity

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

    This data source provides the identity of the current user.

    NOTE: Available in 1.65.0+.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const current = alicloud.getCallerIdentity({});
    export const currentUserArn = current.then(current => current.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    current = alicloud.get_caller_identity()
    pulumi.export("currentUserArn", current.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		current, err := alicloud.GetCallerIdentity(ctx, map[string]interface{}{}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("currentUserArn", current.Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var current = AliCloud.GetCallerIdentity.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["currentUserArn"] = current.Apply(getCallerIdentityResult => getCallerIdentityResult.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.AlicloudFunctions;
    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 current = AlicloudFunctions.getCallerIdentity();
    
            ctx.export("currentUserArn", current.applyValue(getCallerIdentityResult -> getCallerIdentityResult.id()));
        }
    }
    
    variables:
      current:
        fn::invoke:
          Function: alicloud:getCallerIdentity
          Arguments: {}
    outputs:
      currentUserArn: ${current.id}
    

    Using getCallerIdentity

    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 getCallerIdentity(opts?: InvokeOptions): Promise<GetCallerIdentityResult>
    function getCallerIdentityOutput(opts?: InvokeOptions): Output<GetCallerIdentityResult>
    def get_caller_identity(opts: Optional[InvokeOptions] = None) -> GetCallerIdentityResult
    def get_caller_identity_output(opts: Optional[InvokeOptions] = None) -> Output[GetCallerIdentityResult]
    func GetCallerIdentity(ctx *Context, opts ...InvokeOption) (*GetCallerIdentityResult, error)
    func GetCallerIdentityOutput(ctx *Context, opts ...InvokeOption) GetCallerIdentityResultOutput

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

    public static class GetCallerIdentity 
    {
        public static Task<GetCallerIdentityResult> InvokeAsync(InvokeOptions? opts = null)
        public static Output<GetCallerIdentityResult> Invoke(InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetCallerIdentityResult> getCallerIdentity(InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:index/getCallerIdentity:getCallerIdentity
      arguments:
        # arguments dictionary

    getCallerIdentity Result

    The following output properties are available:

    AccountId string
    Account ID.
    Arn string
    The Alibaba Cloud Resource Name (ARN) of the user making the call.
    Id string
    The provider-assigned unique ID for this managed resource.
    IdentityType string
    The type of the princiapal. RAMUser for users.
    AccountId string
    Account ID.
    Arn string
    The Alibaba Cloud Resource Name (ARN) of the user making the call.
    Id string
    The provider-assigned unique ID for this managed resource.
    IdentityType string
    The type of the princiapal. RAMUser for users.
    accountId String
    Account ID.
    arn String
    The Alibaba Cloud Resource Name (ARN) of the user making the call.
    id String
    The provider-assigned unique ID for this managed resource.
    identityType String
    The type of the princiapal. RAMUser for users.
    accountId string
    Account ID.
    arn string
    The Alibaba Cloud Resource Name (ARN) of the user making the call.
    id string
    The provider-assigned unique ID for this managed resource.
    identityType string
    The type of the princiapal. RAMUser for users.
    account_id str
    Account ID.
    arn str
    The Alibaba Cloud Resource Name (ARN) of the user making the call.
    id str
    The provider-assigned unique ID for this managed resource.
    identity_type str
    The type of the princiapal. RAMUser for users.
    accountId String
    Account ID.
    arn String
    The Alibaba Cloud Resource Name (ARN) of the user making the call.
    id String
    The provider-assigned unique ID for this managed resource.
    identityType String
    The type of the princiapal. RAMUser for users.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi