1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. vpc
  5. getIpv4Gateways
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.vpc.getIpv4Gateways

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

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);
Copy
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)
Copy
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
	})
}
Copy
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),
    };
});
Copy
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()));
    }
}
Copy
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}
Copy

Using getIpv4Gateways

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 getIpv4Gateways(args: GetIpv4GatewaysArgs, opts?: InvokeOptions): Promise<GetIpv4GatewaysResult>
function getIpv4GatewaysOutput(args: GetIpv4GatewaysOutputArgs, opts?: InvokeOptions): Output<GetIpv4GatewaysResult>
Copy
def get_ipv4_gateways(ids: Optional[Sequence[str]] = None,
                      ipv4_gateway_name: Optional[str] = None,
                      name_regex: Optional[str] = None,
                      output_file: Optional[str] = None,
                      status: Optional[str] = None,
                      vpc_id: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetIpv4GatewaysResult
def get_ipv4_gateways_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                      ipv4_gateway_name: Optional[pulumi.Input[str]] = None,
                      name_regex: Optional[pulumi.Input[str]] = None,
                      output_file: Optional[pulumi.Input[str]] = None,
                      status: Optional[pulumi.Input[str]] = None,
                      vpc_id: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetIpv4GatewaysResult]
Copy
func GetIpv4Gateways(ctx *Context, args *GetIpv4GatewaysArgs, opts ...InvokeOption) (*GetIpv4GatewaysResult, error)
func GetIpv4GatewaysOutput(ctx *Context, args *GetIpv4GatewaysOutputArgs, opts ...InvokeOption) GetIpv4GatewaysResultOutput
Copy

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

public static class GetIpv4Gateways 
{
    public static Task<GetIpv4GatewaysResult> InvokeAsync(GetIpv4GatewaysArgs args, InvokeOptions? opts = null)
    public static Output<GetIpv4GatewaysResult> Invoke(GetIpv4GatewaysInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetIpv4GatewaysResult> getIpv4Gateways(GetIpv4GatewaysArgs args, InvokeOptions options)
public static Output<GetIpv4GatewaysResult> getIpv4Gateways(GetIpv4GatewaysArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:vpc/getIpv4Gateways:getIpv4Gateways
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Ids Changes to this property will trigger replacement. List<string>
A list of Ipv4 Gateway IDs.
Ipv4GatewayName Changes to this property will trigger replacement. string
The name of the IPv4 gateway.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Ipv4 Gateway name.
OutputFile string
File name where to save data source results (after running pulumi preview).
Status Changes to this property will trigger replacement. string
The status of the resource. Valid values: Creating, Created, Deleting, Pending, Deleted.
VpcId Changes to this property will trigger replacement. string
The ID of the VPC associated with the IPv4 Gateway.
Ids Changes to this property will trigger replacement. []string
A list of Ipv4 Gateway IDs.
Ipv4GatewayName Changes to this property will trigger replacement. string
The name of the IPv4 gateway.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Ipv4 Gateway name.
OutputFile string
File name where to save data source results (after running pulumi preview).
Status Changes to this property will trigger replacement. string
The status of the resource. Valid values: Creating, Created, Deleting, Pending, Deleted.
VpcId Changes to this property will trigger replacement. string
The ID of the VPC associated with the IPv4 Gateway.
ids Changes to this property will trigger replacement. List<String>
A list of Ipv4 Gateway IDs.
ipv4GatewayName Changes to this property will trigger replacement. String
The name of the IPv4 gateway.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Ipv4 Gateway name.
outputFile String
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. String
The status of the resource. Valid values: Creating, Created, Deleting, Pending, Deleted.
vpcId Changes to this property will trigger replacement. String
The ID of the VPC associated with the IPv4 Gateway.
ids Changes to this property will trigger replacement. string[]
A list of Ipv4 Gateway IDs.
ipv4GatewayName Changes to this property will trigger replacement. string
The name of the IPv4 gateway.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Ipv4 Gateway name.
outputFile string
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. string
The status of the resource. Valid values: Creating, Created, Deleting, Pending, Deleted.
vpcId Changes to this property will trigger replacement. string
The ID of the VPC associated with the IPv4 Gateway.
ids Changes to this property will trigger replacement. Sequence[str]
A list of Ipv4 Gateway IDs.
ipv4_gateway_name Changes to this property will trigger replacement. str
The name of the IPv4 gateway.
name_regex Changes to this property will trigger replacement. str
A regex string to filter results by Ipv4 Gateway name.
output_file str
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. str
The status of the resource. Valid values: Creating, Created, Deleting, Pending, Deleted.
vpc_id Changes to this property will trigger replacement. str
The ID of the VPC associated with the IPv4 Gateway.
ids Changes to this property will trigger replacement. List<String>
A list of Ipv4 Gateway IDs.
ipv4GatewayName Changes to this property will trigger replacement. String
The name of the IPv4 gateway.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Ipv4 Gateway name.
outputFile String
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. String
The status of the resource. Valid values: Creating, Created, Deleting, Pending, Deleted.
vpcId Changes to this property will trigger replacement. String
The ID of the VPC associated with the IPv4 Gateway.

getIpv4Gateways Result

The following output properties are available:

Gateways List<Pulumi.AliCloud.Vpc.Outputs.GetIpv4GatewaysGateway>
Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
Names List<string>
Ipv4GatewayName string
NameRegex string
OutputFile string
Status string
VpcId string
Gateways []GetIpv4GatewaysGateway
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
Names []string
Ipv4GatewayName string
NameRegex string
OutputFile string
Status string
VpcId string
gateways List<GetIpv4GatewaysGateway>
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
ipv4GatewayName String
nameRegex String
outputFile String
status String
vpcId String
gateways GetIpv4GatewaysGateway[]
id string
The provider-assigned unique ID for this managed resource.
ids string[]
names string[]
ipv4GatewayName string
nameRegex string
outputFile string
status string
vpcId string
gateways Sequence[GetIpv4GatewaysGateway]
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
names Sequence[str]
ipv4_gateway_name str
name_regex str
output_file str
status str
vpc_id str
gateways List<Property Map>
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
ipv4GatewayName String
nameRegex String
outputFile String
status String
vpcId String

Supporting Types

GetIpv4GatewaysGateway

CreateTime This property is required. string
The creation time of the resource.
Enabled This property is required. bool
Indicates whether the IPv4 gateway is activated.
Id This property is required. string
The ID of the Ipv4 Gateway.
Ipv4GatewayDescription This property is required. string
The description of the IPv4 gateway.
Ipv4GatewayId This property is required. string
The resource attribute field that represents the resource level 1 ID.
Ipv4GatewayName This property is required. string
The name of the IPv4 gateway.
Ipv4GatewayRouteTableId This property is required. string
ID of the route table associated with IPv4 Gateway.
Status This property is required. string
The status of the resource.
VpcId This property is required. string
The ID of the VPC associated with the IPv4 Gateway.
CreateTime This property is required. string
The creation time of the resource.
Enabled This property is required. bool
Indicates whether the IPv4 gateway is activated.
Id This property is required. string
The ID of the Ipv4 Gateway.
Ipv4GatewayDescription This property is required. string
The description of the IPv4 gateway.
Ipv4GatewayId This property is required. string
The resource attribute field that represents the resource level 1 ID.
Ipv4GatewayName This property is required. string
The name of the IPv4 gateway.
Ipv4GatewayRouteTableId This property is required. string
ID of the route table associated with IPv4 Gateway.
Status This property is required. string
The status of the resource.
VpcId This property is required. string
The ID of the VPC associated with the IPv4 Gateway.
createTime This property is required. String
The creation time of the resource.
enabled This property is required. Boolean
Indicates whether the IPv4 gateway is activated.
id This property is required. String
The ID of the Ipv4 Gateway.
ipv4GatewayDescription This property is required. String
The description of the IPv4 gateway.
ipv4GatewayId This property is required. String
The resource attribute field that represents the resource level 1 ID.
ipv4GatewayName This property is required. String
The name of the IPv4 gateway.
ipv4GatewayRouteTableId This property is required. String
ID of the route table associated with IPv4 Gateway.
status This property is required. String
The status of the resource.
vpcId This property is required. String
The ID of the VPC associated with the IPv4 Gateway.
createTime This property is required. string
The creation time of the resource.
enabled This property is required. boolean
Indicates whether the IPv4 gateway is activated.
id This property is required. string
The ID of the Ipv4 Gateway.
ipv4GatewayDescription This property is required. string
The description of the IPv4 gateway.
ipv4GatewayId This property is required. string
The resource attribute field that represents the resource level 1 ID.
ipv4GatewayName This property is required. string
The name of the IPv4 gateway.
ipv4GatewayRouteTableId This property is required. string
ID of the route table associated with IPv4 Gateway.
status This property is required. string
The status of the resource.
vpcId This property is required. string
The ID of the VPC associated with the IPv4 Gateway.
create_time This property is required. str
The creation time of the resource.
enabled This property is required. bool
Indicates whether the IPv4 gateway is activated.
id This property is required. str
The ID of the Ipv4 Gateway.
ipv4_gateway_description This property is required. str
The description of the IPv4 gateway.
ipv4_gateway_id This property is required. str
The resource attribute field that represents the resource level 1 ID.
ipv4_gateway_name This property is required. str
The name of the IPv4 gateway.
ipv4_gateway_route_table_id This property is required. str
ID of the route table associated with IPv4 Gateway.
status This property is required. str
The status of the resource.
vpc_id This property is required. str
The ID of the VPC associated with the IPv4 Gateway.
createTime This property is required. String
The creation time of the resource.
enabled This property is required. Boolean
Indicates whether the IPv4 gateway is activated.
id This property is required. String
The ID of the Ipv4 Gateway.
ipv4GatewayDescription This property is required. String
The description of the IPv4 gateway.
ipv4GatewayId This property is required. String
The resource attribute field that represents the resource level 1 ID.
ipv4GatewayName This property is required. String
The name of the IPv4 gateway.
ipv4GatewayRouteTableId This property is required. String
ID of the route table associated with IPv4 Gateway.
status This property is required. String
The status of the resource.
vpcId This property is required. String
The ID of the VPC associated with the IPv4 Gateway.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi