1. Packages
  2. Cloudflare Provider
  3. API Docs
  4. getApiTokenPermissionGroups
Cloudflare v5.43.0 published on Wednesday, Nov 13, 2024 by Pulumi

cloudflare.getApiTokenPermissionGroups

Explore with Pulumi AI

cloudflare logo
Cloudflare v5.43.0 published on Wednesday, Nov 13, 2024 by Pulumi

    Use this data source to look up API Token Permission Groups. Commonly used as references within cloudflare_token resources.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudflare from "@pulumi/cloudflare";
    
    const all = cloudflare.getApiTokenPermissionGroups({});
    export const dnsReadPermissionId = all.then(all => all.zone?.["DNS Read"]);
    export const accountLbMonitorsAndReadId = all.then(all => all.account?.["Load Balancing: Monitors and Pools Read"]);
    export const userMembershipsReadId = all.then(all => all.user?.["Memberships Read"]);
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    
    all = cloudflare.get_api_token_permission_groups()
    pulumi.export("dnsReadPermissionId", all.zone["DNS Read"])
    pulumi.export("accountLbMonitorsAndReadId", all.account["Load Balancing: Monitors and Pools Read"])
    pulumi.export("userMembershipsReadId", all.user["Memberships Read"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    all, err := cloudflare.GetApiTokenPermissionGroups(ctx, map[string]interface{}{
    }, nil);
    if err != nil {
    return err
    }
    ctx.Export("dnsReadPermissionId", all.Zone.DNS Read)
    ctx.Export("accountLbMonitorsAndReadId", all.Account.Load Balancing: Monitors and Pools Read)
    ctx.Export("userMembershipsReadId", all.User.Memberships Read)
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Cloudflare = Pulumi.Cloudflare;
    
    return await Deployment.RunAsync(() => 
    {
        var all = Cloudflare.GetApiTokenPermissionGroups.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["dnsReadPermissionId"] = all.Apply(getApiTokenPermissionGroupsResult => getApiTokenPermissionGroupsResult.Zone?.DNS_Read),
            ["accountLbMonitorsAndReadId"] = all.Apply(getApiTokenPermissionGroupsResult => getApiTokenPermissionGroupsResult.Account?.Load_Balancing__Monitors_and_Pools_Read),
            ["userMembershipsReadId"] = all.Apply(getApiTokenPermissionGroupsResult => getApiTokenPermissionGroupsResult.User?.Memberships_Read),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cloudflare.CloudflareFunctions;
    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 all = CloudflareFunctions.getApiTokenPermissionGroups();
    
            ctx.export("dnsReadPermissionId", all.applyValue(getApiTokenPermissionGroupsResult -> getApiTokenPermissionGroupsResult.zone().DNS Read()));
            ctx.export("accountLbMonitorsAndReadId", all.applyValue(getApiTokenPermissionGroupsResult -> getApiTokenPermissionGroupsResult.account().Load Balancing: Monitors and Pools Read()));
            ctx.export("userMembershipsReadId", all.applyValue(getApiTokenPermissionGroupsResult -> getApiTokenPermissionGroupsResult.user().Memberships Read()));
        }
    }
    
    variables:
      all:
        fn::invoke:
          Function: cloudflare:getApiTokenPermissionGroups
          Arguments: {}
    outputs:
      # Get zone level DNS read permission ID.
      dnsReadPermissionId: ${all.zone"DNS Read"[%!s(MISSING)]}
      # Get account level "Load Balancing: Monitors and Pools Read" permission ID.
      accountLbMonitorsAndReadId: '${all.account"Load Balancing: Monitors and Pools Read"[%!s(MISSING)]}'
      # Get user level "Memberships Read" permission ID.
      userMembershipsReadId: ${all.user"Memberships Read"[%!s(MISSING)]}
    

    Using getApiTokenPermissionGroups

    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 getApiTokenPermissionGroups(opts?: InvokeOptions): Promise<GetApiTokenPermissionGroupsResult>
    function getApiTokenPermissionGroupsOutput(opts?: InvokeOptions): Output<GetApiTokenPermissionGroupsResult>
    def get_api_token_permission_groups(opts: Optional[InvokeOptions] = None) -> GetApiTokenPermissionGroupsResult
    def get_api_token_permission_groups_output(opts: Optional[InvokeOptions] = None) -> Output[GetApiTokenPermissionGroupsResult]
    func GetApiTokenPermissionGroups(ctx *Context, opts ...InvokeOption) (*GetApiTokenPermissionGroupsResult, error)
    func GetApiTokenPermissionGroupsOutput(ctx *Context, opts ...InvokeOption) GetApiTokenPermissionGroupsResultOutput

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

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

    getApiTokenPermissionGroups Result

    The following output properties are available:

    Account Dictionary<string, string>
    Map of permissions for account level resources.
    Id string
    Checksum of permissions.
    Permissions Dictionary<string, string>
    Map of all permissions available. Should not be used as some permissions will overlap resource scope. Instead, use resource level specific attributes.

    Deprecated: Use specific account, zone or user attributes instead.

    R2 Dictionary<string, string>
    Map of permissions for r2 level resources.
    User Dictionary<string, string>
    Map of permissions for user level resources.
    Zone Dictionary<string, string>
    Map of permissions for zone level resources.
    Account map[string]string
    Map of permissions for account level resources.
    Id string
    Checksum of permissions.
    Permissions map[string]string
    Map of all permissions available. Should not be used as some permissions will overlap resource scope. Instead, use resource level specific attributes.

    Deprecated: Use specific account, zone or user attributes instead.

    R2 map[string]string
    Map of permissions for r2 level resources.
    User map[string]string
    Map of permissions for user level resources.
    Zone map[string]string
    Map of permissions for zone level resources.
    account Map<String,String>
    Map of permissions for account level resources.
    id String
    Checksum of permissions.
    permissions Map<String,String>
    Map of all permissions available. Should not be used as some permissions will overlap resource scope. Instead, use resource level specific attributes.

    Deprecated: Use specific account, zone or user attributes instead.

    r2 Map<String,String>
    Map of permissions for r2 level resources.
    user Map<String,String>
    Map of permissions for user level resources.
    zone Map<String,String>
    Map of permissions for zone level resources.
    account {[key: string]: string}
    Map of permissions for account level resources.
    id string
    Checksum of permissions.
    permissions {[key: string]: string}
    Map of all permissions available. Should not be used as some permissions will overlap resource scope. Instead, use resource level specific attributes.

    Deprecated: Use specific account, zone or user attributes instead.

    r2 {[key: string]: string}
    Map of permissions for r2 level resources.
    user {[key: string]: string}
    Map of permissions for user level resources.
    zone {[key: string]: string}
    Map of permissions for zone level resources.
    account Mapping[str, str]
    Map of permissions for account level resources.
    id str
    Checksum of permissions.
    permissions Mapping[str, str]
    Map of all permissions available. Should not be used as some permissions will overlap resource scope. Instead, use resource level specific attributes.

    Deprecated: Use specific account, zone or user attributes instead.

    r2 Mapping[str, str]
    Map of permissions for r2 level resources.
    user Mapping[str, str]
    Map of permissions for user level resources.
    zone Mapping[str, str]
    Map of permissions for zone level resources.
    account Map<String>
    Map of permissions for account level resources.
    id String
    Checksum of permissions.
    permissions Map<String>
    Map of all permissions available. Should not be used as some permissions will overlap resource scope. Instead, use resource level specific attributes.

    Deprecated: Use specific account, zone or user attributes instead.

    r2 Map<String>
    Map of permissions for r2 level resources.
    user Map<String>
    Map of permissions for user level resources.
    zone Map<String>
    Map of permissions for zone level resources.

    Package Details

    Repository
    Cloudflare pulumi/pulumi-cloudflare
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the cloudflare Terraform Provider.
    cloudflare logo
    Cloudflare v5.43.0 published on Wednesday, Nov 13, 2024 by Pulumi