Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi
alicloud.mhub.getProducts
Explore with Pulumi AI
This data source provides the Mhub Products of the current Alibaba Cloud user.
NOTE: Available in v1.138.0+.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "example_value";
const _default = new alicloud.mhub.Product("default", {productName: name});
const ids = alicloud.mhub.getProducts({});
export const mhubProductId1 = ids.then(ids => ids.products?.[0]?.id);
const nameRegex = alicloud.mhub.getProducts({
nameRegex: "^my-Product",
});
export const mhubProductId2 = nameRegex.then(nameRegex => nameRegex.products?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "example_value"
default = alicloud.mhub.Product("default", product_name=name)
ids = alicloud.mhub.get_products()
pulumi.export("mhubProductId1", ids.products[0].id)
name_regex = alicloud.mhub.get_products(name_regex="^my-Product")
pulumi.export("mhubProductId2", name_regex.products[0].id)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/mhub"
"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, "")
name := "example_value"
if param := cfg.Get("name"); param != "" {
name = param
}
_, err := mhub.NewProduct(ctx, "default", &mhub.ProductArgs{
ProductName: pulumi.String(name),
})
if err != nil {
return err
}
ids, err := mhub.GetProducts(ctx, &mhub.GetProductsArgs{}, nil)
if err != nil {
return err
}
ctx.Export("mhubProductId1", ids.Products[0].Id)
nameRegex, err := mhub.GetProducts(ctx, &mhub.GetProductsArgs{
NameRegex: pulumi.StringRef("^my-Product"),
}, nil)
if err != nil {
return err
}
ctx.Export("mhubProductId2", nameRegex.Products[0].Id)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "example_value";
var @default = new AliCloud.Mhub.Product("default", new()
{
ProductName = name,
});
var ids = AliCloud.Mhub.GetProducts.Invoke();
var nameRegex = AliCloud.Mhub.GetProducts.Invoke(new()
{
NameRegex = "^my-Product",
});
return new Dictionary<string, object?>
{
["mhubProductId1"] = ids.Apply(getProductsResult => getProductsResult.Products[0]?.Id),
["mhubProductId2"] = nameRegex.Apply(getProductsResult => getProductsResult.Products[0]?.Id),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.mhub.Product;
import com.pulumi.alicloud.mhub.ProductArgs;
import com.pulumi.alicloud.mhub.MhubFunctions;
import com.pulumi.alicloud.mhub.inputs.GetProductsArgs;
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 name = config.get("name").orElse("example_value");
var default_ = new Product("default", ProductArgs.builder()
.productName(name)
.build());
final var ids = MhubFunctions.getProducts();
ctx.export("mhubProductId1", ids.applyValue(getProductsResult -> getProductsResult.products()[0].id()));
final var nameRegex = MhubFunctions.getProducts(GetProductsArgs.builder()
.nameRegex("^my-Product")
.build());
ctx.export("mhubProductId2", nameRegex.applyValue(getProductsResult -> getProductsResult.products()[0].id()));
}
}
configuration:
name:
type: string
default: example_value
resources:
default:
type: alicloud:mhub:Product
properties:
productName: ${name}
variables:
ids:
fn::invoke:
Function: alicloud:mhub:getProducts
Arguments: {}
nameRegex:
fn::invoke:
Function: alicloud:mhub:getProducts
Arguments:
nameRegex: ^my-Product
outputs:
mhubProductId1: ${ids.products[0].id}
mhubProductId2: ${nameRegex.products[0].id}
Using getProducts
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 getProducts(args: GetProductsArgs, opts?: InvokeOptions): Promise<GetProductsResult>
function getProductsOutput(args: GetProductsOutputArgs, opts?: InvokeOptions): Output<GetProductsResult>
def get_products(ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetProductsResult
def get_products_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetProductsResult]
func GetProducts(ctx *Context, args *GetProductsArgs, opts ...InvokeOption) (*GetProductsResult, error)
func GetProductsOutput(ctx *Context, args *GetProductsOutputArgs, opts ...InvokeOption) GetProductsResultOutput
> Note: This function is named GetProducts
in the Go SDK.
public static class GetProducts
{
public static Task<GetProductsResult> InvokeAsync(GetProductsArgs args, InvokeOptions? opts = null)
public static Output<GetProductsResult> Invoke(GetProductsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetProductsResult> getProducts(GetProductsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: alicloud:mhub/getProducts:getProducts
arguments:
# arguments dictionary
The following arguments are supported:
- Ids List<string>
- A list of Product IDs.
- Name
Regex string - A regex string to filter results by Product name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- Ids []string
- A list of Product IDs.
- Name
Regex string - A regex string to filter results by Product name.
- Output
File string - File name where to save data source results (after running
pulumi preview
).
- ids List<String>
- A list of Product IDs.
- name
Regex String - A regex string to filter results by Product name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
- ids string[]
- A list of Product IDs.
- name
Regex string - A regex string to filter results by Product name.
- output
File string - File name where to save data source results (after running
pulumi preview
).
- ids Sequence[str]
- A list of Product IDs.
- name_
regex str - A regex string to filter results by Product name.
- output_
file str - File name where to save data source results (after running
pulumi preview
).
- ids List<String>
- A list of Product IDs.
- name
Regex String - A regex string to filter results by Product name.
- output
File String - File name where to save data source results (after running
pulumi preview
).
getProducts Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Names List<string>
- Products
List<Pulumi.
Ali Cloud. Mhub. Outputs. Get Products Product> - Name
Regex string - Output
File string
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Names []string
- Products
[]Get
Products Product - Name
Regex string - Output
File string
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- products
List<Get
Products Product> - name
Regex String - output
File String
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- names string[]
- products
Get
Products Product[] - name
Regex string - output
File string
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- names Sequence[str]
- products
Sequence[Get
Products Product] - name_
regex str - output_
file str
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- products List<Property Map>
- name
Regex String - output
File String
Supporting Types
GetProductsProduct
- Id string
- The ID of the Product.
- Product
Id string - The ID of the Product.
- Product
Name string - The name of the Product.
- Id string
- The ID of the Product.
- Product
Id string - The ID of the Product.
- Product
Name string - The name of the Product.
- id String
- The ID of the Product.
- product
Id String - The ID of the Product.
- product
Name String - The name of the Product.
- id string
- The ID of the Product.
- product
Id string - The ID of the Product.
- product
Name string - The name of the Product.
- id str
- The ID of the Product.
- product_
id str - The ID of the Product.
- product_
name str - The name of the Product.
- id String
- The ID of the Product.
- product
Id String - The ID of the Product.
- product
Name String - The name of the Product.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.