1. Packages
  2. AWS
  3. API Docs
  4. amp
  5. getWorkspaces
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.amp.getWorkspaces

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Provides the aliases, ARNs, and workspace IDs of Amazon Prometheus workspaces.

    Example Usage

    The following example returns all of the workspaces in a region:

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.amp.getWorkspaces({});
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.amp.get_workspaces()
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/amp"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := amp.GetWorkspaces(ctx, &amp.GetWorkspacesArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.Amp.GetWorkspaces.Invoke();
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.amp.AmpFunctions;
    import com.pulumi.aws.amp.inputs.GetWorkspacesArgs;
    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 = AmpFunctions.getWorkspaces();
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: aws:amp:getWorkspaces
          Arguments: {}
    

    The following example filters the workspaces by alias. Only the workspaces with aliases that begin with the value of alias_prefix will be returned:

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = aws.amp.getWorkspaces({
        aliasPrefix: "example",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.amp.get_workspaces(alias_prefix="example")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/amp"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := amp.GetWorkspaces(ctx, &amp.GetWorkspacesArgs{
    			AliasPrefix: pulumi.StringRef("example"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Aws.Amp.GetWorkspaces.Invoke(new()
        {
            AliasPrefix = "example",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.amp.AmpFunctions;
    import com.pulumi.aws.amp.inputs.GetWorkspacesArgs;
    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 = AmpFunctions.getWorkspaces(GetWorkspacesArgs.builder()
                .aliasPrefix("example")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: aws:amp:getWorkspaces
          Arguments:
            aliasPrefix: example
    

    Using getWorkspaces

    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 getWorkspaces(args: GetWorkspacesArgs, opts?: InvokeOptions): Promise<GetWorkspacesResult>
    function getWorkspacesOutput(args: GetWorkspacesOutputArgs, opts?: InvokeOptions): Output<GetWorkspacesResult>
    def get_workspaces(alias_prefix: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetWorkspacesResult
    def get_workspaces_output(alias_prefix: Optional[pulumi.Input[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetWorkspacesResult]
    func GetWorkspaces(ctx *Context, args *GetWorkspacesArgs, opts ...InvokeOption) (*GetWorkspacesResult, error)
    func GetWorkspacesOutput(ctx *Context, args *GetWorkspacesOutputArgs, opts ...InvokeOption) GetWorkspacesResultOutput

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

    public static class GetWorkspaces 
    {
        public static Task<GetWorkspacesResult> InvokeAsync(GetWorkspacesArgs args, InvokeOptions? opts = null)
        public static Output<GetWorkspacesResult> Invoke(GetWorkspacesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetWorkspacesResult> getWorkspaces(GetWorkspacesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:amp/getWorkspaces:getWorkspaces
      arguments:
        # arguments dictionary

    The following arguments are supported:

    AliasPrefix string
    Limits results to workspaces with aliases that begin with this value.
    AliasPrefix string
    Limits results to workspaces with aliases that begin with this value.
    aliasPrefix String
    Limits results to workspaces with aliases that begin with this value.
    aliasPrefix string
    Limits results to workspaces with aliases that begin with this value.
    alias_prefix str
    Limits results to workspaces with aliases that begin with this value.
    aliasPrefix String
    Limits results to workspaces with aliases that begin with this value.

    getWorkspaces Result

    The following output properties are available:

    Aliases List<string>
    List of aliases of the matched Prometheus workspaces.
    Arns List<string>
    List of ARNs of the matched Prometheus workspaces.
    Id string
    The provider-assigned unique ID for this managed resource.
    WorkspaceIds List<string>
    List of workspace IDs of the matched Prometheus workspaces.
    AliasPrefix string
    Aliases []string
    List of aliases of the matched Prometheus workspaces.
    Arns []string
    List of ARNs of the matched Prometheus workspaces.
    Id string
    The provider-assigned unique ID for this managed resource.
    WorkspaceIds []string
    List of workspace IDs of the matched Prometheus workspaces.
    AliasPrefix string
    aliases List<String>
    List of aliases of the matched Prometheus workspaces.
    arns List<String>
    List of ARNs of the matched Prometheus workspaces.
    id String
    The provider-assigned unique ID for this managed resource.
    workspaceIds List<String>
    List of workspace IDs of the matched Prometheus workspaces.
    aliasPrefix String
    aliases string[]
    List of aliases of the matched Prometheus workspaces.
    arns string[]
    List of ARNs of the matched Prometheus workspaces.
    id string
    The provider-assigned unique ID for this managed resource.
    workspaceIds string[]
    List of workspace IDs of the matched Prometheus workspaces.
    aliasPrefix string
    aliases Sequence[str]
    List of aliases of the matched Prometheus workspaces.
    arns Sequence[str]
    List of ARNs of the matched Prometheus workspaces.
    id str
    The provider-assigned unique ID for this managed resource.
    workspace_ids Sequence[str]
    List of workspace IDs of the matched Prometheus workspaces.
    alias_prefix str
    aliases List<String>
    List of aliases of the matched Prometheus workspaces.
    arns List<String>
    List of ARNs of the matched Prometheus workspaces.
    id String
    The provider-assigned unique ID for this managed resource.
    workspaceIds List<String>
    List of workspace IDs of the matched Prometheus workspaces.
    aliasPrefix String

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi