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

alicloud.cloudmonitor.ServiceHybridDoubleWrite

Explore with Pulumi AI

Provides a Cloud Monitor Service Hybrid Double Write resource.

For information about Cloud Monitor Service Hybrid Double Write and how to use it, see What is Hybrid Double Write.

NOTE: Available since v1.210.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") || "tf-example";
const _default = alicloud.getAccount({});
const source = new alicloud.cms.Namespace("source", {namespace: name});
const defaultNamespace = new alicloud.cms.Namespace("default", {namespace: `${name}-source`});
const defaultServiceHybridDoubleWrite = new alicloud.cloudmonitor.ServiceHybridDoubleWrite("default", {
    sourceNamespace: source.id,
    sourceUserId: _default.then(_default => _default.id),
    namespace: defaultNamespace.id,
    userId: _default.then(_default => _default.id),
});
Copy
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "tf-example"
default = alicloud.get_account()
source = alicloud.cms.Namespace("source", namespace=name)
default_namespace = alicloud.cms.Namespace("default", namespace=f"{name}-source")
default_service_hybrid_double_write = alicloud.cloudmonitor.ServiceHybridDoubleWrite("default",
    source_namespace=source.id,
    source_user_id=default.id,
    namespace=default_namespace.id,
    user_id=default.id)
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cloudmonitor"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cms"
	"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 := "tf-example"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		_default, err := alicloud.GetAccount(ctx, map[string]interface{}{}, nil)
		if err != nil {
			return err
		}
		source, err := cms.NewNamespace(ctx, "source", &cms.NamespaceArgs{
			Namespace: pulumi.String(name),
		})
		if err != nil {
			return err
		}
		defaultNamespace, err := cms.NewNamespace(ctx, "default", &cms.NamespaceArgs{
			Namespace: pulumi.Sprintf("%v-source", name),
		})
		if err != nil {
			return err
		}
		_, err = cloudmonitor.NewServiceHybridDoubleWrite(ctx, "default", &cloudmonitor.ServiceHybridDoubleWriteArgs{
			SourceNamespace: source.ID(),
			SourceUserId:    pulumi.String(_default.Id),
			Namespace:       defaultNamespace.ID(),
			UserId:          pulumi.String(_default.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
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") ?? "tf-example";
    var @default = AliCloud.GetAccount.Invoke();

    var source = new AliCloud.Cms.Namespace("source", new()
    {
        NamespaceName = name,
    });

    var defaultNamespace = new AliCloud.Cms.Namespace("default", new()
    {
        NamespaceName = $"{name}-source",
    });

    var defaultServiceHybridDoubleWrite = new AliCloud.CloudMonitor.ServiceHybridDoubleWrite("default", new()
    {
        SourceNamespace = source.Id,
        SourceUserId = @default.Apply(@default => @default.Apply(getAccountResult => getAccountResult.Id)),
        Namespace = defaultNamespace.Id,
        UserId = @default.Apply(@default => @default.Apply(getAccountResult => getAccountResult.Id)),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
import com.pulumi.alicloud.cms.Namespace;
import com.pulumi.alicloud.cms.NamespaceArgs;
import com.pulumi.alicloud.cloudmonitor.ServiceHybridDoubleWrite;
import com.pulumi.alicloud.cloudmonitor.ServiceHybridDoubleWriteArgs;
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("tf-example");
        final var default = AlicloudFunctions.getAccount();

        var source = new Namespace("source", NamespaceArgs.builder()
            .namespace(name)
            .build());

        var defaultNamespace = new Namespace("defaultNamespace", NamespaceArgs.builder()
            .namespace(String.format("%s-source", name))
            .build());

        var defaultServiceHybridDoubleWrite = new ServiceHybridDoubleWrite("defaultServiceHybridDoubleWrite", ServiceHybridDoubleWriteArgs.builder()
            .sourceNamespace(source.id())
            .sourceUserId(default_.id())
            .namespace(defaultNamespace.id())
            .userId(default_.id())
            .build());

    }
}
Copy
configuration:
  name:
    type: string
    default: tf-example
resources:
  source:
    type: alicloud:cms:Namespace
    properties:
      namespace: ${name}
  defaultNamespace:
    type: alicloud:cms:Namespace
    name: default
    properties:
      namespace: ${name}-source
  defaultServiceHybridDoubleWrite:
    type: alicloud:cloudmonitor:ServiceHybridDoubleWrite
    name: default
    properties:
      sourceNamespace: ${source.id}
      sourceUserId: ${default.id}
      namespace: ${defaultNamespace.id}
      userId: ${default.id}
variables:
  default:
    fn::invoke:
      function: alicloud:getAccount
      arguments: {}
Copy

Create ServiceHybridDoubleWrite Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ServiceHybridDoubleWrite(name: string, args: ServiceHybridDoubleWriteArgs, opts?: CustomResourceOptions);
@overload
def ServiceHybridDoubleWrite(resource_name: str,
                             args: ServiceHybridDoubleWriteArgs,
                             opts: Optional[ResourceOptions] = None)

@overload
def ServiceHybridDoubleWrite(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             namespace: Optional[str] = None,
                             source_namespace: Optional[str] = None,
                             source_user_id: Optional[str] = None,
                             user_id: Optional[str] = None)
func NewServiceHybridDoubleWrite(ctx *Context, name string, args ServiceHybridDoubleWriteArgs, opts ...ResourceOption) (*ServiceHybridDoubleWrite, error)
public ServiceHybridDoubleWrite(string name, ServiceHybridDoubleWriteArgs args, CustomResourceOptions? opts = null)
public ServiceHybridDoubleWrite(String name, ServiceHybridDoubleWriteArgs args)
public ServiceHybridDoubleWrite(String name, ServiceHybridDoubleWriteArgs args, CustomResourceOptions options)
type: alicloud:cloudmonitor:ServiceHybridDoubleWrite
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ServiceHybridDoubleWriteArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ServiceHybridDoubleWriteArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ServiceHybridDoubleWriteArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ServiceHybridDoubleWriteArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ServiceHybridDoubleWriteArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var serviceHybridDoubleWriteResource = new AliCloud.CloudMonitor.ServiceHybridDoubleWrite("serviceHybridDoubleWriteResource", new()
{
    Namespace = "string",
    SourceNamespace = "string",
    SourceUserId = "string",
    UserId = "string",
});
Copy
example, err := cloudmonitor.NewServiceHybridDoubleWrite(ctx, "serviceHybridDoubleWriteResource", &cloudmonitor.ServiceHybridDoubleWriteArgs{
	Namespace:       pulumi.String("string"),
	SourceNamespace: pulumi.String("string"),
	SourceUserId:    pulumi.String("string"),
	UserId:          pulumi.String("string"),
})
Copy
var serviceHybridDoubleWriteResource = new ServiceHybridDoubleWrite("serviceHybridDoubleWriteResource", ServiceHybridDoubleWriteArgs.builder()
    .namespace("string")
    .sourceNamespace("string")
    .sourceUserId("string")
    .userId("string")
    .build());
Copy
service_hybrid_double_write_resource = alicloud.cloudmonitor.ServiceHybridDoubleWrite("serviceHybridDoubleWriteResource",
    namespace="string",
    source_namespace="string",
    source_user_id="string",
    user_id="string")
Copy
const serviceHybridDoubleWriteResource = new alicloud.cloudmonitor.ServiceHybridDoubleWrite("serviceHybridDoubleWriteResource", {
    namespace: "string",
    sourceNamespace: "string",
    sourceUserId: "string",
    userId: "string",
});
Copy
type: alicloud:cloudmonitor:ServiceHybridDoubleWrite
properties:
    namespace: string
    sourceNamespace: string
    sourceUserId: string
    userId: string
Copy

ServiceHybridDoubleWrite Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ServiceHybridDoubleWrite resource accepts the following input properties:

Namespace
This property is required.
Changes to this property will trigger replacement.
string
Target Namespace.
SourceNamespace
This property is required.
Changes to this property will trigger replacement.
string
Source Namespace.
SourceUserId
This property is required.
Changes to this property will trigger replacement.
string
Source UserId.
UserId
This property is required.
Changes to this property will trigger replacement.
string
Target UserId.
Namespace
This property is required.
Changes to this property will trigger replacement.
string
Target Namespace.
SourceNamespace
This property is required.
Changes to this property will trigger replacement.
string
Source Namespace.
SourceUserId
This property is required.
Changes to this property will trigger replacement.
string
Source UserId.
UserId
This property is required.
Changes to this property will trigger replacement.
string
Target UserId.
namespace
This property is required.
Changes to this property will trigger replacement.
String
Target Namespace.
sourceNamespace
This property is required.
Changes to this property will trigger replacement.
String
Source Namespace.
sourceUserId
This property is required.
Changes to this property will trigger replacement.
String
Source UserId.
userId
This property is required.
Changes to this property will trigger replacement.
String
Target UserId.
namespace
This property is required.
Changes to this property will trigger replacement.
string
Target Namespace.
sourceNamespace
This property is required.
Changes to this property will trigger replacement.
string
Source Namespace.
sourceUserId
This property is required.
Changes to this property will trigger replacement.
string
Source UserId.
userId
This property is required.
Changes to this property will trigger replacement.
string
Target UserId.
namespace
This property is required.
Changes to this property will trigger replacement.
str
Target Namespace.
source_namespace
This property is required.
Changes to this property will trigger replacement.
str
Source Namespace.
source_user_id
This property is required.
Changes to this property will trigger replacement.
str
Source UserId.
user_id
This property is required.
Changes to this property will trigger replacement.
str
Target UserId.
namespace
This property is required.
Changes to this property will trigger replacement.
String
Target Namespace.
sourceNamespace
This property is required.
Changes to this property will trigger replacement.
String
Source Namespace.
sourceUserId
This property is required.
Changes to this property will trigger replacement.
String
Source UserId.
userId
This property is required.
Changes to this property will trigger replacement.
String
Target UserId.

Outputs

All input properties are implicitly available as output properties. Additionally, the ServiceHybridDoubleWrite resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ServiceHybridDoubleWrite Resource

Get an existing ServiceHybridDoubleWrite resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ServiceHybridDoubleWriteState, opts?: CustomResourceOptions): ServiceHybridDoubleWrite
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        namespace: Optional[str] = None,
        source_namespace: Optional[str] = None,
        source_user_id: Optional[str] = None,
        user_id: Optional[str] = None) -> ServiceHybridDoubleWrite
func GetServiceHybridDoubleWrite(ctx *Context, name string, id IDInput, state *ServiceHybridDoubleWriteState, opts ...ResourceOption) (*ServiceHybridDoubleWrite, error)
public static ServiceHybridDoubleWrite Get(string name, Input<string> id, ServiceHybridDoubleWriteState? state, CustomResourceOptions? opts = null)
public static ServiceHybridDoubleWrite get(String name, Output<String> id, ServiceHybridDoubleWriteState state, CustomResourceOptions options)
resources:  _:    type: alicloud:cloudmonitor:ServiceHybridDoubleWrite    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Namespace Changes to this property will trigger replacement. string
Target Namespace.
SourceNamespace Changes to this property will trigger replacement. string
Source Namespace.
SourceUserId Changes to this property will trigger replacement. string
Source UserId.
UserId Changes to this property will trigger replacement. string
Target UserId.
Namespace Changes to this property will trigger replacement. string
Target Namespace.
SourceNamespace Changes to this property will trigger replacement. string
Source Namespace.
SourceUserId Changes to this property will trigger replacement. string
Source UserId.
UserId Changes to this property will trigger replacement. string
Target UserId.
namespace Changes to this property will trigger replacement. String
Target Namespace.
sourceNamespace Changes to this property will trigger replacement. String
Source Namespace.
sourceUserId Changes to this property will trigger replacement. String
Source UserId.
userId Changes to this property will trigger replacement. String
Target UserId.
namespace Changes to this property will trigger replacement. string
Target Namespace.
sourceNamespace Changes to this property will trigger replacement. string
Source Namespace.
sourceUserId Changes to this property will trigger replacement. string
Source UserId.
userId Changes to this property will trigger replacement. string
Target UserId.
namespace Changes to this property will trigger replacement. str
Target Namespace.
source_namespace Changes to this property will trigger replacement. str
Source Namespace.
source_user_id Changes to this property will trigger replacement. str
Source UserId.
user_id Changes to this property will trigger replacement. str
Target UserId.
namespace Changes to this property will trigger replacement. String
Target Namespace.
sourceNamespace Changes to this property will trigger replacement. String
Source Namespace.
sourceUserId Changes to this property will trigger replacement. String
Source UserId.
userId Changes to this property will trigger replacement. String
Target UserId.

Import

Cloud Monitor Service Hybrid Double Write can be imported using the id, e.g.

$ pulumi import alicloud:cloudmonitor/serviceHybridDoubleWrite:ServiceHybridDoubleWrite example <source_namespace>:<source_user_id>
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.