Alibaba Cloud

v3.10.0 published on Wednesday, Nov 24, 2021 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

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 = exampleNamespace.NamespaceId.Apply(namespaceId => AliCloud.Sae.GetConfigMaps.InvokeAsync(new AliCloud.Sae.GetConfigMapsArgs
        {
            NamespaceId = 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
		}
		ctx.Export("saeConfigMapId", nameRegex.ApplyT(func(nameRegex sae.GetConfigMapsResult) (string, error) {
			return nameRegex.Maps[0].Id, nil
		}).(pulumi.StringOutput))
		return nil
	})
}
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 = example_namespace.namespace_id.apply(lambda namespace_id: alicloud.sae.get_config_maps(namespace_id=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 = exampleNamespace.namespaceId.apply(namespaceId => alicloud.sae.getConfigMaps({
    namespaceId: namespaceId,
    nameRegex: "^example",
}));
export const saeConfigMapId = nameRegex.apply(nameRegex => 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)
}

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 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

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 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

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.
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.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.