get Ipv4Gateways
This data source provides the Vpc Ipv4 Gateways of the current Alibaba Cloud user.
NOTE: Available in v1.181.0+.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.vpc.getIpv4Gateways({});
export const vpcIpv4GatewayId1 = ids.then(ids => ids.gateways?.[0]?.id);
const nameRegex = alicloud.vpc.getIpv4Gateways({
nameRegex: "^my-Ipv4Gateway",
});
export const vpcIpv4GatewayId2 = nameRegex.then(nameRegex => nameRegex.gateways?.[0]?.id);
Content copied to clipboard
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.vpc.get_ipv4_gateways()
pulumi.export("vpcIpv4GatewayId1", ids.gateways[0].id)
name_regex = alicloud.vpc.get_ipv4_gateways(name_regex="^my-Ipv4Gateway")
pulumi.export("vpcIpv4GatewayId2", name_regex.gateways[0].id)
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.Vpc.GetIpv4Gateways.Invoke();
var nameRegex = AliCloud.Vpc.GetIpv4Gateways.Invoke(new()
{
NameRegex = "^my-Ipv4Gateway",
});
return new Dictionary<string, object?>
{
["vpcIpv4GatewayId1"] = ids.Apply(getIpv4GatewaysResult => getIpv4GatewaysResult.Gateways[0]?.Id),
["vpcIpv4GatewayId2"] = nameRegex.Apply(getIpv4GatewaysResult => getIpv4GatewaysResult.Gateways[0]?.Id),
};
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ids, err := vpc.GetIpv4Gateways(ctx, &vpc.GetIpv4GatewaysArgs{}, nil)
if err != nil {
return err
}
ctx.Export("vpcIpv4GatewayId1", ids.Gateways[0].Id)
nameRegex, err := vpc.GetIpv4Gateways(ctx, &vpc.GetIpv4GatewaysArgs{
NameRegex: pulumi.StringRef("^my-Ipv4Gateway"),
}, nil)
if err != nil {
return err
}
ctx.Export("vpcIpv4GatewayId2", nameRegex.Gateways[0].Id)
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.vpc.VpcFunctions;
import com.pulumi.alicloud.vpc.inputs.GetIpv4GatewaysArgs;
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 ids = VpcFunctions.getIpv4Gateways();
ctx.export("vpcIpv4GatewayId1", ids.applyValue(getIpv4GatewaysResult -> getIpv4GatewaysResult.gateways()[0].id()));
final var nameRegex = VpcFunctions.getIpv4Gateways(GetIpv4GatewaysArgs.builder()
.nameRegex("^my-Ipv4Gateway")
.build());
ctx.export("vpcIpv4GatewayId2", nameRegex.applyValue(getIpv4GatewaysResult -> getIpv4GatewaysResult.gateways()[0].id()));
}
}
Content copied to clipboard
variables:
ids:
fn::invoke:
function: alicloud:vpc:getIpv4Gateways
arguments: {}
nameRegex:
fn::invoke:
function: alicloud:vpc:getIpv4Gateways
arguments:
nameRegex: ^my-Ipv4Gateway
outputs:
vpcIpv4GatewayId1: ${ids.gateways[0].id}
vpcIpv4GatewayId2: ${nameRegex.gateways[0].id}
Content copied to clipboard
Return
A collection of values returned by getIpv4Gateways.
Parameters
argument
A collection of arguments for invoking getIpv4Gateways.
suspend fun getIpv4Gateways(ids: List<String>? = null, ipv4GatewayName: String? = null, nameRegex: String? = null, outputFile: String? = null, status: String? = null, vpcId: String? = null): GetIpv4GatewaysResult
Return
A collection of values returned by getIpv4Gateways.
Parameters
ids
A list of Ipv4 Gateway IDs.
ipv4Gateway Name
The name of the IPv4 gateway.
name Regex
A regex string to filter results by Ipv4 Gateway name.
output File
File name where to save data source results (after running pulumi preview
).
status
The status of the resource. Valid values: Creating
, Created
, Deleting
, Pending
, Deleted
.
vpc Id
The ID of the VPC associated with the IPv4 Gateway.
See also
suspend fun getIpv4Gateways(argument: suspend GetIpv4GatewaysPlainArgsBuilder.() -> Unit): GetIpv4GatewaysResult
Return
A collection of values returned by getIpv4Gateways.
Parameters
argument
Builder for com.pulumi.alicloud.vpc.kotlin.inputs.GetIpv4GatewaysPlainArgs.