Volcengine v0.0.27 published on Tuesday, Dec 10, 2024 by Volcengine
volcengine.mongodb.Endpoints
Explore with Pulumi AI
Use this data source to query detailed information of mongodb endpoints
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as volcengine from "@pulumi/volcengine";
import * as volcengine from "@volcengine/pulumi";
const fooZones = volcengine.ecs.Zones({});
const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
    vpcName: "acc-test-vpc",
    cidrBlock: "172.16.0.0/16",
});
const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
    subnetName: "acc-test-subnet",
    cidrBlock: "172.16.0.0/24",
    zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
    vpcId: fooVpc.id,
});
const fooInstance = new volcengine.mongodb.Instance("fooInstance", {
    dbEngineVersion: "MongoDB_4_0",
    instanceType: "ShardedCluster",
    superAccountPassword: "@acc-test-123",
    nodeSpec: "mongo.shard.1c2g",
    mongosNodeSpec: "mongo.mongos.1c2g",
    instanceName: "acc-test-mongo-shard",
    chargeType: "PostPaid",
    projectName: "default",
    mongosNodeNumber: 2,
    shardNumber: 2,
    storageSpaceGb: 20,
    subnetId: fooSubnet.id,
    zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
    tags: [{
        key: "k1",
        value: "v1",
    }],
});
const fooAddress: volcengine.eip.Address[] = [];
for (const range = {value: 0}; range.value < 2; range.value++) {
    fooAddress.push(new volcengine.eip.Address(`fooAddress-${range.value}`, {
        billingType: "PostPaidByBandwidth",
        bandwidth: 1,
        isp: "ChinaUnicom",
        description: "acc-test",
        projectName: "default",
    }));
}
const fooPublic = new volcengine.mongodb.Endpoint("fooPublic", {
    instanceId: fooInstance.id,
    networkType: "Public",
    objectId: fooInstance.mongosId,
    mongosNodeIds: [
        fooInstance.mongos.apply(mongos => mongos[0].mongosNodeId),
        fooInstance.mongos.apply(mongos => mongos[1].mongosNodeId),
    ],
    eipIds: fooAddress.map(__item => __item.id),
});
const fooPrivate = new volcengine.mongodb.Endpoint("fooPrivate", {
    instanceId: fooInstance.id,
    networkType: "Private",
    objectId: fooInstance.configServersId,
});
const fooEndpoints = volcengine.mongodb.EndpointsOutput({
    instanceId: fooInstance.id,
});
import pulumi
import pulumi_volcengine as volcengine
foo_zones = volcengine.ecs.zones()
foo_vpc = volcengine.vpc.Vpc("fooVpc",
    vpc_name="acc-test-vpc",
    cidr_block="172.16.0.0/16")
foo_subnet = volcengine.vpc.Subnet("fooSubnet",
    subnet_name="acc-test-subnet",
    cidr_block="172.16.0.0/24",
    zone_id=foo_zones.zones[0].id,
    vpc_id=foo_vpc.id)
foo_instance = volcengine.mongodb.Instance("fooInstance",
    db_engine_version="MongoDB_4_0",
    instance_type="ShardedCluster",
    super_account_password="@acc-test-123",
    node_spec="mongo.shard.1c2g",
    mongos_node_spec="mongo.mongos.1c2g",
    instance_name="acc-test-mongo-shard",
    charge_type="PostPaid",
    project_name="default",
    mongos_node_number=2,
    shard_number=2,
    storage_space_gb=20,
    subnet_id=foo_subnet.id,
    zone_id=foo_zones.zones[0].id,
    tags=[volcengine.mongodb.InstanceTagArgs(
        key="k1",
        value="v1",
    )])
foo_address = []
for range in [{"value": i} for i in range(0, 2)]:
    foo_address.append(volcengine.eip.Address(f"fooAddress-{range['value']}",
        billing_type="PostPaidByBandwidth",
        bandwidth=1,
        isp="ChinaUnicom",
        description="acc-test",
        project_name="default"))
foo_public = volcengine.mongodb.Endpoint("fooPublic",
    instance_id=foo_instance.id,
    network_type="Public",
    object_id=foo_instance.mongos_id,
    mongos_node_ids=[
        foo_instance.mongos[0].mongos_node_id,
        foo_instance.mongos[1].mongos_node_id,
    ],
    eip_ids=[__item.id for __item in foo_address])
foo_private = volcengine.mongodb.Endpoint("fooPrivate",
    instance_id=foo_instance.id,
    network_type="Private",
    object_id=foo_instance.config_servers_id)
foo_endpoints = volcengine.mongodb.endpoints_output(instance_id=foo_instance.id)
package main
import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/eip"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/mongodb"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vpc"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		fooZones, err := ecs.Zones(ctx, nil, nil)
		if err != nil {
			return err
		}
		fooVpc, err := vpc.NewVpc(ctx, "fooVpc", &vpc.VpcArgs{
			VpcName:   pulumi.String("acc-test-vpc"),
			CidrBlock: pulumi.String("172.16.0.0/16"),
		})
		if err != nil {
			return err
		}
		fooSubnet, err := vpc.NewSubnet(ctx, "fooSubnet", &vpc.SubnetArgs{
			SubnetName: pulumi.String("acc-test-subnet"),
			CidrBlock:  pulumi.String("172.16.0.0/24"),
			ZoneId:     pulumi.String(fooZones.Zones[0].Id),
			VpcId:      fooVpc.ID(),
		})
		if err != nil {
			return err
		}
		fooInstance, err := mongodb.NewInstance(ctx, "fooInstance", &mongodb.InstanceArgs{
			DbEngineVersion:      pulumi.String("MongoDB_4_0"),
			InstanceType:         pulumi.String("ShardedCluster"),
			SuperAccountPassword: pulumi.String("@acc-test-123"),
			NodeSpec:             pulumi.String("mongo.shard.1c2g"),
			MongosNodeSpec:       pulumi.String("mongo.mongos.1c2g"),
			InstanceName:         pulumi.String("acc-test-mongo-shard"),
			ChargeType:           pulumi.String("PostPaid"),
			ProjectName:          pulumi.String("default"),
			MongosNodeNumber:     pulumi.Int(2),
			ShardNumber:          pulumi.Int(2),
			StorageSpaceGb:       pulumi.Int(20),
			SubnetId:             fooSubnet.ID(),
			ZoneId:               pulumi.String(fooZones.Zones[0].Id),
			Tags: mongodb.InstanceTagArray{
				&mongodb.InstanceTagArgs{
					Key:   pulumi.String("k1"),
					Value: pulumi.String("v1"),
				},
			},
		})
		if err != nil {
			return err
		}
		var fooAddress []*eip.Address
		for index := 0; index < 2; index++ {
			key0 := index
			_ := index
			__res, err := eip.NewAddress(ctx, fmt.Sprintf("fooAddress-%v", key0), &eip.AddressArgs{
				BillingType: pulumi.String("PostPaidByBandwidth"),
				Bandwidth:   pulumi.Int(1),
				Isp:         pulumi.String("ChinaUnicom"),
				Description: pulumi.String("acc-test"),
				ProjectName: pulumi.String("default"),
			})
			if err != nil {
				return err
			}
			fooAddress = append(fooAddress, __res)
		}
		var splat0 pulumi.StringArray
		for _, val0 := range fooAddress {
			splat0 = append(splat0, val0.ID())
		}
		_, err = mongodb.NewEndpoint(ctx, "fooPublic", &mongodb.EndpointArgs{
			InstanceId:  fooInstance.ID(),
			NetworkType: pulumi.String("Public"),
			ObjectId:    fooInstance.MongosId,
			MongosNodeIds: pulumi.StringArray{
				fooInstance.Mongos.ApplyT(func(mongos []mongodb.InstanceMongo) (*string, error) {
					return &mongos[0].MongosNodeId, nil
				}).(pulumi.StringPtrOutput),
				fooInstance.Mongos.ApplyT(func(mongos []mongodb.InstanceMongo) (*string, error) {
					return &mongos[1].MongosNodeId, nil
				}).(pulumi.StringPtrOutput),
			},
			EipIds: splat0,
		})
		if err != nil {
			return err
		}
		_, err = mongodb.NewEndpoint(ctx, "fooPrivate", &mongodb.EndpointArgs{
			InstanceId:  fooInstance.ID(),
			NetworkType: pulumi.String("Private"),
			ObjectId:    fooInstance.ConfigServersId,
		})
		if err != nil {
			return err
		}
		_ = mongodb.EndpointsOutput(ctx, mongodb.EndpointsOutputArgs{
			InstanceId: fooInstance.ID(),
		}, nil)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcengine = Pulumi.Volcengine;
return await Deployment.RunAsync(() => 
{
    var fooZones = Volcengine.Ecs.Zones.Invoke();
    var fooVpc = new Volcengine.Vpc.Vpc("fooVpc", new()
    {
        VpcName = "acc-test-vpc",
        CidrBlock = "172.16.0.0/16",
    });
    var fooSubnet = new Volcengine.Vpc.Subnet("fooSubnet", new()
    {
        SubnetName = "acc-test-subnet",
        CidrBlock = "172.16.0.0/24",
        ZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
        VpcId = fooVpc.Id,
    });
    var fooInstance = new Volcengine.Mongodb.Instance("fooInstance", new()
    {
        DbEngineVersion = "MongoDB_4_0",
        InstanceType = "ShardedCluster",
        SuperAccountPassword = "@acc-test-123",
        NodeSpec = "mongo.shard.1c2g",
        MongosNodeSpec = "mongo.mongos.1c2g",
        InstanceName = "acc-test-mongo-shard",
        ChargeType = "PostPaid",
        ProjectName = "default",
        MongosNodeNumber = 2,
        ShardNumber = 2,
        StorageSpaceGb = 20,
        SubnetId = fooSubnet.Id,
        ZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
        Tags = new[]
        {
            new Volcengine.Mongodb.Inputs.InstanceTagArgs
            {
                Key = "k1",
                Value = "v1",
            },
        },
    });
    var fooAddress = new List<Volcengine.Eip.Address>();
    for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        fooAddress.Add(new Volcengine.Eip.Address($"fooAddress-{range.Value}", new()
        {
            BillingType = "PostPaidByBandwidth",
            Bandwidth = 1,
            Isp = "ChinaUnicom",
            Description = "acc-test",
            ProjectName = "default",
        }));
    }
    var fooPublic = new Volcengine.Mongodb.Endpoint("fooPublic", new()
    {
        InstanceId = fooInstance.Id,
        NetworkType = "Public",
        ObjectId = fooInstance.MongosId,
        MongosNodeIds = new[]
        {
            fooInstance.Mongos.Apply(mongos => mongos[0].MongosNodeId),
            fooInstance.Mongos.Apply(mongos => mongos[1].MongosNodeId),
        },
        EipIds = fooAddress.Select(__item => __item.Id).ToList(),
    });
    var fooPrivate = new Volcengine.Mongodb.Endpoint("fooPrivate", new()
    {
        InstanceId = fooInstance.Id,
        NetworkType = "Private",
        ObjectId = fooInstance.ConfigServersId,
    });
    var fooEndpoints = Volcengine.Mongodb.Endpoints.Invoke(new()
    {
        InstanceId = fooInstance.Id,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.volcengine.ecs.EcsFunctions;
import com.pulumi.volcengine.ecs.inputs.ZonesArgs;
import com.pulumi.volcengine.vpc.Vpc;
import com.pulumi.volcengine.vpc.VpcArgs;
import com.pulumi.volcengine.vpc.Subnet;
import com.pulumi.volcengine.vpc.SubnetArgs;
import com.pulumi.volcengine.mongodb.Instance;
import com.pulumi.volcengine.mongodb.InstanceArgs;
import com.pulumi.volcengine.mongodb.inputs.InstanceTagArgs;
import com.pulumi.volcengine.eip.Address;
import com.pulumi.volcengine.eip.AddressArgs;
import com.pulumi.volcengine.mongodb.Endpoint;
import com.pulumi.volcengine.mongodb.EndpointArgs;
import com.pulumi.volcengine.mongodb.MongodbFunctions;
import com.pulumi.volcengine.mongodb.inputs.EndpointsArgs;
import com.pulumi.codegen.internal.KeyedValue;
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 fooZones = EcsFunctions.Zones();
        var fooVpc = new Vpc("fooVpc", VpcArgs.builder()        
            .vpcName("acc-test-vpc")
            .cidrBlock("172.16.0.0/16")
            .build());
        var fooSubnet = new Subnet("fooSubnet", SubnetArgs.builder()        
            .subnetName("acc-test-subnet")
            .cidrBlock("172.16.0.0/24")
            .zoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
            .vpcId(fooVpc.id())
            .build());
        var fooInstance = new Instance("fooInstance", InstanceArgs.builder()        
            .dbEngineVersion("MongoDB_4_0")
            .instanceType("ShardedCluster")
            .superAccountPassword("@acc-test-123")
            .nodeSpec("mongo.shard.1c2g")
            .mongosNodeSpec("mongo.mongos.1c2g")
            .instanceName("acc-test-mongo-shard")
            .chargeType("PostPaid")
            .projectName("default")
            .mongosNodeNumber(2)
            .shardNumber(2)
            .storageSpaceGb(20)
            .subnetId(fooSubnet.id())
            .zoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
            .tags(InstanceTagArgs.builder()
                .key("k1")
                .value("v1")
                .build())
            .build());
        for (var i = 0; i < 2; i++) {
            new Address("fooAddress-" + i, AddressArgs.builder()            
                .billingType("PostPaidByBandwidth")
                .bandwidth(1)
                .isp("ChinaUnicom")
                .description("acc-test")
                .projectName("default")
                .build());
        
}
        var fooPublic = new Endpoint("fooPublic", EndpointArgs.builder()        
            .instanceId(fooInstance.id())
            .networkType("Public")
            .objectId(fooInstance.mongosId())
            .mongosNodeIds(            
                fooInstance.mongos().applyValue(mongos -> mongos[0].mongosNodeId()),
                fooInstance.mongos().applyValue(mongos -> mongos[1].mongosNodeId()))
            .eipIds(fooAddress.stream().map(element -> element.id()).collect(toList()))
            .build());
        var fooPrivate = new Endpoint("fooPrivate", EndpointArgs.builder()        
            .instanceId(fooInstance.id())
            .networkType("Private")
            .objectId(fooInstance.configServersId())
            .build());
        final var fooEndpoints = MongodbFunctions.Endpoints(EndpointsArgs.builder()
            .instanceId(fooInstance.id())
            .build());
    }
}
Coming soon!
Using Endpoints
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 endpoints(args: EndpointsArgs, opts?: InvokeOptions): Promise<EndpointsResult>
function endpointsOutput(args: EndpointsOutputArgs, opts?: InvokeOptions): Output<EndpointsResult>def endpoints(instance_id: Optional[str] = None,
              output_file: Optional[str] = None,
              opts: Optional[InvokeOptions] = None) -> EndpointsResult
def endpoints_output(instance_id: Optional[pulumi.Input[str]] = None,
              output_file: Optional[pulumi.Input[str]] = None,
              opts: Optional[InvokeOptions] = None) -> Output[EndpointsResult]func Endpoints(ctx *Context, args *EndpointsArgs, opts ...InvokeOption) (*EndpointsResult, error)
func EndpointsOutput(ctx *Context, args *EndpointsOutputArgs, opts ...InvokeOption) EndpointsResultOutputpublic static class Endpoints 
{
    public static Task<EndpointsResult> InvokeAsync(EndpointsArgs args, InvokeOptions? opts = null)
    public static Output<EndpointsResult> Invoke(EndpointsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<EndpointsResult> endpoints(EndpointsArgs args, InvokeOptions options)
public static Output<EndpointsResult> endpoints(EndpointsArgs args, InvokeOptions options)
fn::invoke:
  function: volcengine:mongodb:Endpoints
  arguments:
    # arguments dictionaryThe following arguments are supported:
- InstanceId string
- The instance ID to query.
- OutputFile string
- File name where to save data source results.
- InstanceId string
- The instance ID to query.
- OutputFile string
- File name where to save data source results.
- instanceId String
- The instance ID to query.
- outputFile String
- File name where to save data source results.
- instanceId string
- The instance ID to query.
- outputFile string
- File name where to save data source results.
- instance_id str
- The instance ID to query.
- output_file str
- File name where to save data source results.
- instanceId String
- The instance ID to query.
- outputFile String
- File name where to save data source results.
Endpoints Result
The following output properties are available:
- Endpoints
List<EndpointsEndpoint> 
- The collection of mongodb endpoints query.
- Id string
- The provider-assigned unique ID for this managed resource.
- TotalCount int
- The total count of mongodb endpoint query.
- InstanceId string
- OutputFile string
- Endpoints
[]EndpointsEndpoint 
- The collection of mongodb endpoints query.
- Id string
- The provider-assigned unique ID for this managed resource.
- TotalCount int
- The total count of mongodb endpoint query.
- InstanceId string
- OutputFile string
- endpoints
List<EndpointsEndpoint> 
- The collection of mongodb endpoints query.
- id String
- The provider-assigned unique ID for this managed resource.
- totalCount Integer
- The total count of mongodb endpoint query.
- instanceId String
- outputFile String
- endpoints
EndpointsEndpoint[] 
- The collection of mongodb endpoints query.
- id string
- The provider-assigned unique ID for this managed resource.
- totalCount number
- The total count of mongodb endpoint query.
- instanceId string
- outputFile string
- endpoints
Sequence[EndpointsEndpoint] 
- The collection of mongodb endpoints query.
- id str
- The provider-assigned unique ID for this managed resource.
- total_count int
- The total count of mongodb endpoint query.
- instance_id str
- output_file str
- endpoints List<Property Map>
- The collection of mongodb endpoints query.
- id String
- The provider-assigned unique ID for this managed resource.
- totalCount Number
- The total count of mongodb endpoint query.
- instanceId String
- outputFile String
Supporting Types
EndpointsEndpoint 
- DbAddresses List<EndpointsEndpoint Db Address> 
- The list of mongodb addresses.
- EndpointId string
- The ID of endpoint.
- EndpointStr string
- The endpoint information.
- EndpointType string
- The node type corresponding to the endpoint.
- NetworkType string
- The network type of endpoint.
- ObjectId string
- The object ID corresponding to the endpoint.
- SubnetId string
- The subnet ID.
- VpcId string
- The VPC ID.
- DbAddresses []EndpointsEndpoint Db Address 
- The list of mongodb addresses.
- EndpointId string
- The ID of endpoint.
- EndpointStr string
- The endpoint information.
- EndpointType string
- The node type corresponding to the endpoint.
- NetworkType string
- The network type of endpoint.
- ObjectId string
- The object ID corresponding to the endpoint.
- SubnetId string
- The subnet ID.
- VpcId string
- The VPC ID.
- dbAddresses List<EndpointsEndpoint Db Address> 
- The list of mongodb addresses.
- endpointId String
- The ID of endpoint.
- endpointStr String
- The endpoint information.
- endpointType String
- The node type corresponding to the endpoint.
- networkType String
- The network type of endpoint.
- objectId String
- The object ID corresponding to the endpoint.
- subnetId String
- The subnet ID.
- vpcId String
- The VPC ID.
- dbAddresses EndpointsEndpoint Db Address[] 
- The list of mongodb addresses.
- endpointId string
- The ID of endpoint.
- endpointStr string
- The endpoint information.
- endpointType string
- The node type corresponding to the endpoint.
- networkType string
- The network type of endpoint.
- objectId string
- The object ID corresponding to the endpoint.
- subnetId string
- The subnet ID.
- vpcId string
- The VPC ID.
- db_addresses Sequence[EndpointsEndpoint Db Address] 
- The list of mongodb addresses.
- endpoint_id str
- The ID of endpoint.
- endpoint_str str
- The endpoint information.
- endpoint_type str
- The node type corresponding to the endpoint.
- network_type str
- The network type of endpoint.
- object_id str
- The object ID corresponding to the endpoint.
- subnet_id str
- The subnet ID.
- vpc_id str
- The VPC ID.
- dbAddresses List<Property Map>
- The list of mongodb addresses.
- endpointId String
- The ID of endpoint.
- endpointStr String
- The endpoint information.
- endpointType String
- The node type corresponding to the endpoint.
- networkType String
- The network type of endpoint.
- objectId String
- The object ID corresponding to the endpoint.
- subnetId String
- The subnet ID.
- vpcId String
- The VPC ID.
EndpointsEndpointDbAddress   
- AddressDomain string
- The domain of mongodb connection.
- AddressIp string
- The IP of mongodb connection.
- AddressPort string
- The port of mongodb connection.
- AddressType string
- The connection type of mongodb.
- EipId string
- The EIP ID bound to the instance's public network address.
- NodeId string
- The node ID.
- AddressDomain string
- The domain of mongodb connection.
- AddressIp string
- The IP of mongodb connection.
- AddressPort string
- The port of mongodb connection.
- AddressType string
- The connection type of mongodb.
- EipId string
- The EIP ID bound to the instance's public network address.
- NodeId string
- The node ID.
- addressDomain String
- The domain of mongodb connection.
- addressIp String
- The IP of mongodb connection.
- addressPort String
- The port of mongodb connection.
- addressType String
- The connection type of mongodb.
- eipId String
- The EIP ID bound to the instance's public network address.
- nodeId String
- The node ID.
- addressDomain string
- The domain of mongodb connection.
- addressIp string
- The IP of mongodb connection.
- addressPort string
- The port of mongodb connection.
- addressType string
- The connection type of mongodb.
- eipId string
- The EIP ID bound to the instance's public network address.
- nodeId string
- The node ID.
- address_domain str
- The domain of mongodb connection.
- address_ip str
- The IP of mongodb connection.
- address_port str
- The port of mongodb connection.
- address_type str
- The connection type of mongodb.
- eip_id str
- The EIP ID bound to the instance's public network address.
- node_id str
- The node ID.
- addressDomain String
- The domain of mongodb connection.
- addressIp String
- The IP of mongodb connection.
- addressPort String
- The port of mongodb connection.
- addressType String
- The connection type of mongodb.
- eipId String
- The EIP ID bound to the instance's public network address.
- nodeId String
- The node ID.
Package Details
- Repository
- volcengine volcengine/pulumi-volcengine
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the volcengineTerraform Provider.