1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. cloudmonitor
  5. ServiceHybridDoubleWrite
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.cloudmonitor.ServiceHybridDoubleWrite

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

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

    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 string
    The unique name of the resource.
    args ServiceHybridDoubleWriteArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args 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 string
    The unique name of the resource.
    args ServiceHybridDoubleWriteArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServiceHybridDoubleWriteArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args 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",
    });
    
    example, err := cloudmonitor.NewServiceHybridDoubleWrite(ctx, "serviceHybridDoubleWriteResource", &cloudmonitor.ServiceHybridDoubleWriteArgs{
    	Namespace:       pulumi.String("string"),
    	SourceNamespace: pulumi.String("string"),
    	SourceUserId:    pulumi.String("string"),
    	UserId:          pulumi.String("string"),
    })
    
    var serviceHybridDoubleWriteResource = new ServiceHybridDoubleWrite("serviceHybridDoubleWriteResource", ServiceHybridDoubleWriteArgs.builder()
        .namespace("string")
        .sourceNamespace("string")
        .sourceUserId("string")
        .userId("string")
        .build());
    
    service_hybrid_double_write_resource = alicloud.cloudmonitor.ServiceHybridDoubleWrite("serviceHybridDoubleWriteResource",
        namespace="string",
        source_namespace="string",
        source_user_id="string",
        user_id="string")
    
    const serviceHybridDoubleWriteResource = new alicloud.cloudmonitor.ServiceHybridDoubleWrite("serviceHybridDoubleWriteResource", {
        namespace: "string",
        sourceNamespace: "string",
        sourceUserId: "string",
        userId: "string",
    });
    
    type: alicloud:cloudmonitor:ServiceHybridDoubleWrite
    properties:
        namespace: string
        sourceNamespace: string
        sourceUserId: string
        userId: string
    

    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 string
    Target Namespace.
    SourceNamespace string
    Source Namespace.
    SourceUserId string
    Source UserId.
    UserId string
    Target UserId.
    Namespace string
    Target Namespace.
    SourceNamespace string
    Source Namespace.
    SourceUserId string
    Source UserId.
    UserId string
    Target UserId.
    namespace String
    Target Namespace.
    sourceNamespace String
    Source Namespace.
    sourceUserId String
    Source UserId.
    userId String
    Target UserId.
    namespace string
    Target Namespace.
    sourceNamespace string
    Source Namespace.
    sourceUserId string
    Source UserId.
    userId string
    Target UserId.
    namespace str
    Target Namespace.
    source_namespace str
    Source Namespace.
    source_user_id str
    Source UserId.
    user_id str
    Target UserId.
    namespace String
    Target Namespace.
    sourceNamespace String
    Source Namespace.
    sourceUserId String
    Source UserId.
    userId 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)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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 string
    Target Namespace.
    SourceNamespace string
    Source Namespace.
    SourceUserId string
    Source UserId.
    UserId string
    Target UserId.
    Namespace string
    Target Namespace.
    SourceNamespace string
    Source Namespace.
    SourceUserId string
    Source UserId.
    UserId string
    Target UserId.
    namespace String
    Target Namespace.
    sourceNamespace String
    Source Namespace.
    sourceUserId String
    Source UserId.
    userId String
    Target UserId.
    namespace string
    Target Namespace.
    sourceNamespace string
    Source Namespace.
    sourceUserId string
    Source UserId.
    userId string
    Target UserId.
    namespace str
    Target Namespace.
    source_namespace str
    Source Namespace.
    source_user_id str
    Source UserId.
    user_id str
    Target UserId.
    namespace String
    Target Namespace.
    sourceNamespace String
    Source Namespace.
    sourceUserId String
    Source UserId.
    userId 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>
    

    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.
    alicloud logo
    Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi