Alibaba Cloud

v3.28.0 published on Tuesday, Aug 16, 2022 by Pulumi

getConfigMaps

This data source provides the Sae Config Maps of the current Alibaba Cloud user.

NOTE: Available in v1.130.0+.

Example Usage

Basic Usage

using System.Collections.Generic;
using System.Text.Json;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var config = new Config();
        var configMapName = config.Get("configMapName") ?? "examplename";
        var exampleNamespace = new AliCloud.Sae.Namespace("exampleNamespace", new AliCloud.Sae.NamespaceArgs
        {
            NamespaceId = "cn-hangzhou:yourname",
            NamespaceName = "example_value",
            NamespaceDescription = "your_description",
        });
        var exampleConfigMap = new AliCloud.Sae.ConfigMap("exampleConfigMap", new AliCloud.Sae.ConfigMapArgs
        {
            Data = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                { "env.home", "/root" },
                { "env.shell", "/bin/sh" },
            }),
            NamespaceId = exampleNamespace.NamespaceId,
        });
        var nameRegex = AliCloud.Sae.GetConfigMaps.Invoke(new AliCloud.Sae.GetConfigMapsInvokeArgs
        {
            NamespaceId = exampleNamespace.NamespaceId,
            NameRegex = "^example",
        });
        this.SaeConfigMapId = nameRegex.Apply(nameRegex => nameRegex.Maps?[0]?.Id);
    }

    [Output("saeConfigMapId")]
    public Output<string> SaeConfigMapId { get; set; }
}
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/sae"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		configMapName := "examplename"
		if param := cfg.Get("configMapName"); param != "" {
			configMapName = param
		}
		exampleNamespace, err := sae.NewNamespace(ctx, "exampleNamespace", &sae.NamespaceArgs{
			NamespaceId:          pulumi.String("cn-hangzhou:yourname"),
			NamespaceName:        pulumi.String("example_value"),
			NamespaceDescription: pulumi.String("your_description"),
		})
		if err != nil {
			return err
		}
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"env.home":  "/root",
			"env.shell": "/bin/sh",
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		_, err = sae.NewConfigMap(ctx, "exampleConfigMap", &sae.ConfigMapArgs{
			Data:        pulumi.String(json0),
			NamespaceId: exampleNamespace.NamespaceId,
		})
		if err != nil {
			return err
		}
		nameRegex := sae.GetConfigMapsOutput(ctx, sae.GetConfigMapsOutputArgs{
			NamespaceId: exampleNamespace.NamespaceId,
			NameRegex:   pulumi.String("^example"),
		}, nil)
		ctx.Export("saeConfigMapId", nameRegex.ApplyT(func(nameRegex sae.GetConfigMapsResult) (string, error) {
			return nameRegex.Maps[0].Id, nil
		}).(pulumi.StringOutput))
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.sae.Namespace;
import com.pulumi.alicloud.sae.NamespaceArgs;
import com.pulumi.alicloud.sae.ConfigMap;
import com.pulumi.alicloud.sae.ConfigMapArgs;
import com.pulumi.alicloud.sae.SaeFunctions;
import com.pulumi.alicloud.sae.inputs.GetConfigMapsArgs;
import static com.pulumi.codegen.internal.Serialization.*;
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 config = ctx.config();
        final var configMapName = config.get("configMapName").orElse("examplename");
        var exampleNamespace = new Namespace("exampleNamespace", NamespaceArgs.builder()        
            .namespaceId("cn-hangzhou:yourname")
            .namespaceName("example_value")
            .namespaceDescription("your_description")
            .build());

        var exampleConfigMap = new ConfigMap("exampleConfigMap", ConfigMapArgs.builder()        
            .data(serializeJson(
                jsonObject(
                    jsonProperty("env.home", "/root"),
                    jsonProperty("env.shell", "/bin/sh")
                )))
            .namespaceId(exampleNamespace.namespaceId())
            .build());

        final var nameRegex = SaeFunctions.getConfigMaps(GetConfigMapsArgs.builder()
            .namespaceId(exampleNamespace.namespaceId())
            .nameRegex("^example")
            .build());

        ctx.export("saeConfigMapId", nameRegex.applyValue(getConfigMapsResult -> getConfigMapsResult).applyValue(nameRegex -> nameRegex.applyValue(getConfigMapsResult -> getConfigMapsResult.maps()[0].id())));
    }
}
import pulumi
import json
import pulumi_alicloud as alicloud

config = pulumi.Config()
config_map_name = config.get("configMapName")
if config_map_name is None:
    config_map_name = "examplename"
example_namespace = alicloud.sae.Namespace("exampleNamespace",
    namespace_id="cn-hangzhou:yourname",
    namespace_name="example_value",
    namespace_description="your_description")
example_config_map = alicloud.sae.ConfigMap("exampleConfigMap",
    data=json.dumps({
        "env.home": "/root",
        "env.shell": "/bin/sh",
    }),
    namespace_id=example_namespace.namespace_id)
name_regex = alicloud.sae.get_config_maps_output(namespace_id=example_namespace.namespace_id,
    name_regex="^example")
pulumi.export("saeConfigMapId", name_regex.maps[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const configMapName = config.get("configMapName") || "examplename";
const exampleNamespace = new alicloud.sae.Namespace("exampleNamespace", {
    namespaceId: "cn-hangzhou:yourname",
    namespaceName: "example_value",
    namespaceDescription: "your_description",
});
const exampleConfigMap = new alicloud.sae.ConfigMap("exampleConfigMap", {
    data: JSON.stringify({
        "env.home": "/root",
        "env.shell": "/bin/sh",
    }),
    namespaceId: exampleNamespace.namespaceId,
});
const nameRegex = alicloud.sae.getConfigMapsOutput({
    namespaceId: exampleNamespace.namespaceId,
    nameRegex: "^example",
});
export const saeConfigMapId = nameRegex.apply(nameRegex => nameRegex.maps?[0]?.id);
configuration:
  configMapName:
    type: string
    default: examplename
resources:
  exampleNamespace:
    type: alicloud:sae:Namespace
    properties:
      namespaceId: cn-hangzhou:yourname
      namespaceName: example_value
      namespaceDescription: your_description
  exampleConfigMap:
    type: alicloud:sae:ConfigMap
    properties:
      data:
        Fn::ToJSON:
          env.home: /root
          env.shell: /bin/sh
      namespaceId: ${exampleNamespace.namespaceId}
variables:
  nameRegex:
    Fn::Invoke:
      Function: alicloud:sae:getConfigMaps
      Arguments:
        namespaceId: ${exampleNamespace.namespaceId}
        nameRegex: ^example
outputs:
  saeConfigMapId: ${nameRegex.maps[0].id}

Using getConfigMaps

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 getConfigMaps(args: GetConfigMapsArgs, opts?: InvokeOptions): Promise<GetConfigMapsResult>
function getConfigMapsOutput(args: GetConfigMapsOutputArgs, opts?: InvokeOptions): Output<GetConfigMapsResult>
def get_config_maps(ids: Optional[Sequence[str]] = None,
                    name_regex: Optional[str] = None,
                    namespace_id: Optional[str] = None,
                    output_file: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetConfigMapsResult
def get_config_maps_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                    name_regex: Optional[pulumi.Input[str]] = None,
                    namespace_id: Optional[pulumi.Input[str]] = None,
                    output_file: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetConfigMapsResult]
func GetConfigMaps(ctx *Context, args *GetConfigMapsArgs, opts ...InvokeOption) (*GetConfigMapsResult, error)
func GetConfigMapsOutput(ctx *Context, args *GetConfigMapsOutputArgs, opts ...InvokeOption) GetConfigMapsResultOutput

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

public static class GetConfigMaps 
{
    public static Task<GetConfigMapsResult> InvokeAsync(GetConfigMapsArgs args, InvokeOptions? opts = null)
    public static Output<GetConfigMapsResult> Invoke(GetConfigMapsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetConfigMapsResult> getConfigMaps(GetConfigMapsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: alicloud:sae/getConfigMaps:getConfigMaps
  arguments:
    # arguments dictionary

The following arguments are supported:

NamespaceId string

The NamespaceId of Config Maps.

Ids List<string>

A list of Config Map IDs.

NameRegex string

A regex string to filter results by Config Map name.

OutputFile string
NamespaceId string

The NamespaceId of Config Maps.

Ids []string

A list of Config Map IDs.

NameRegex string

A regex string to filter results by Config Map name.

OutputFile string
namespaceId String

The NamespaceId of Config Maps.

ids List<String>

A list of Config Map IDs.

nameRegex String

A regex string to filter results by Config Map name.

outputFile String
namespaceId string

The NamespaceId of Config Maps.

ids string[]

A list of Config Map IDs.

nameRegex string

A regex string to filter results by Config Map name.

outputFile string
namespace_id str

The NamespaceId of Config Maps.

ids Sequence[str]

A list of Config Map IDs.

name_regex str

A regex string to filter results by Config Map name.

output_file str
namespaceId String

The NamespaceId of Config Maps.

ids List<String>

A list of Config Map IDs.

nameRegex String

A regex string to filter results by Config Map name.

outputFile String

getConfigMaps Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>
Maps List<Pulumi.AliCloud.Sae.Outputs.GetConfigMapsMap>
Names List<string>
NamespaceId string
NameRegex string
OutputFile string
Id string

The provider-assigned unique ID for this managed resource.

Ids []string
Maps []GetConfigMapsMap
Names []string
NamespaceId string
NameRegex string
OutputFile string
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
maps List<GetConfigMapsMap>
names List<String>
namespaceId String
nameRegex String
outputFile String
id string

The provider-assigned unique ID for this managed resource.

ids string[]
maps GetConfigMapsMap[]
names string[]
namespaceId string
nameRegex string
outputFile string
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]
maps Sequence[GetConfigMapsMap]
names Sequence[str]
namespace_id str
name_regex str
output_file str
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
maps List<Property Map>
names List<String>
namespaceId String
nameRegex String
outputFile String

Supporting Types

GetConfigMapsMap

ConfigMapId string

The first ID of the resource.

CreateTime string

The Creation Time of the ConfigMap.

Data string

ConfigMap instance data. The value's format is a json string

Description string

The Description of Config Map.

Id string

The ID of the Config Map.

Name string

ConfigMap instance name.

NamespaceId string

The NamespaceId of Config Maps.

ConfigMapId string

The first ID of the resource.

CreateTime string

The Creation Time of the ConfigMap.

Data string

ConfigMap instance data. The value's format is a json string

Description string

The Description of Config Map.

Id string

The ID of the Config Map.

Name string

ConfigMap instance name.

NamespaceId string

The NamespaceId of Config Maps.

configMapId String

The first ID of the resource.

createTime String

The Creation Time of the ConfigMap.

data String

ConfigMap instance data. The value's format is a json string

description String

The Description of Config Map.

id String

The ID of the Config Map.

name String

ConfigMap instance name.

namespaceId String

The NamespaceId of Config Maps.

configMapId string

The first ID of the resource.

createTime string

The Creation Time of the ConfigMap.

data string

ConfigMap instance data. The value's format is a json string

description string

The Description of Config Map.

id string

The ID of the Config Map.

name string

ConfigMap instance name.

namespaceId string

The NamespaceId of Config Maps.

config_map_id str

The first ID of the resource.

create_time str

The Creation Time of the ConfigMap.

data str

ConfigMap instance data. The value's format is a json string

description str

The Description of Config Map.

id str

The ID of the Config Map.

name str

ConfigMap instance name.

namespace_id str

The NamespaceId of Config Maps.

configMapId String

The first ID of the resource.

createTime String

The Creation Time of the ConfigMap.

data String

ConfigMap instance data. The value's format is a json string

description String

The Description of Config Map.

id String

The ID of the Config Map.

name String

ConfigMap instance name.

namespaceId String

The NamespaceId of Config Maps.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.