1. Packages
  2. Opsgenie
  3. API Docs
  4. UserContact
Opsgenie v1.3.8 published on Monday, Jun 24, 2024 by Pulumi

opsgenie.UserContact

Explore with Pulumi AI

opsgenie logo
Opsgenie v1.3.8 published on Monday, Jun 24, 2024 by Pulumi

    Manages a User Contact.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as opsgenie from "@pulumi/opsgenie";
    
    const sms = new opsgenie.UserContact("sms", {
        username: exampleuser.username,
        to: "39-123",
        method: "sms",
    });
    const email = new opsgenie.UserContact("email", {
        username: exampleuser.username,
        to: "fahri@opsgenie.com",
        method: "email",
    });
    const voice = new opsgenie.UserContact("voice", {
        username: exampleuser.username,
        to: "39-123",
        method: "voice",
    });
    
    import pulumi
    import pulumi_opsgenie as opsgenie
    
    sms = opsgenie.UserContact("sms",
        username=exampleuser["username"],
        to="39-123",
        method="sms")
    email = opsgenie.UserContact("email",
        username=exampleuser["username"],
        to="fahri@opsgenie.com",
        method="email")
    voice = opsgenie.UserContact("voice",
        username=exampleuser["username"],
        to="39-123",
        method="voice")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-opsgenie/sdk/go/opsgenie"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := opsgenie.NewUserContact(ctx, "sms", &opsgenie.UserContactArgs{
    			Username: pulumi.Any(exampleuser.Username),
    			To:       pulumi.String("39-123"),
    			Method:   pulumi.String("sms"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = opsgenie.NewUserContact(ctx, "email", &opsgenie.UserContactArgs{
    			Username: pulumi.Any(exampleuser.Username),
    			To:       pulumi.String("fahri@opsgenie.com"),
    			Method:   pulumi.String("email"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = opsgenie.NewUserContact(ctx, "voice", &opsgenie.UserContactArgs{
    			Username: pulumi.Any(exampleuser.Username),
    			To:       pulumi.String("39-123"),
    			Method:   pulumi.String("voice"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Opsgenie = Pulumi.Opsgenie;
    
    return await Deployment.RunAsync(() => 
    {
        var sms = new Opsgenie.UserContact("sms", new()
        {
            Username = exampleuser.Username,
            To = "39-123",
            Method = "sms",
        });
    
        var email = new Opsgenie.UserContact("email", new()
        {
            Username = exampleuser.Username,
            To = "fahri@opsgenie.com",
            Method = "email",
        });
    
        var voice = new Opsgenie.UserContact("voice", new()
        {
            Username = exampleuser.Username,
            To = "39-123",
            Method = "voice",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.opsgenie.UserContact;
    import com.pulumi.opsgenie.UserContactArgs;
    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) {
            var sms = new UserContact("sms", UserContactArgs.builder()
                .username(exampleuser.username())
                .to("39-123")
                .method("sms")
                .build());
    
            var email = new UserContact("email", UserContactArgs.builder()
                .username(exampleuser.username())
                .to("fahri@opsgenie.com")
                .method("email")
                .build());
    
            var voice = new UserContact("voice", UserContactArgs.builder()
                .username(exampleuser.username())
                .to("39-123")
                .method("voice")
                .build());
    
        }
    }
    
    resources:
      sms:
        type: opsgenie:UserContact
        properties:
          username: ${exampleuser.username}
          to: 39-123
          method: sms
      email:
        type: opsgenie:UserContact
        properties:
          username: ${exampleuser.username}
          to: fahri@opsgenie.com
          method: email
      voice:
        type: opsgenie:UserContact
        properties:
          username: ${exampleuser.username}
          to: 39-123
          method: voice
    

    Create UserContact Resource

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

    Constructor syntax

    new UserContact(name: string, args: UserContactArgs, opts?: CustomResourceOptions);
    @overload
    def UserContact(resource_name: str,
                    args: UserContactArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def UserContact(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    method: Optional[str] = None,
                    to: Optional[str] = None,
                    username: Optional[str] = None,
                    enabled: Optional[bool] = None)
    func NewUserContact(ctx *Context, name string, args UserContactArgs, opts ...ResourceOption) (*UserContact, error)
    public UserContact(string name, UserContactArgs args, CustomResourceOptions? opts = null)
    public UserContact(String name, UserContactArgs args)
    public UserContact(String name, UserContactArgs args, CustomResourceOptions options)
    
    type: opsgenie:UserContact
    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 UserContactArgs
    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 UserContactArgs
    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 UserContactArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args UserContactArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args UserContactArgs
    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 userContactResource = new Opsgenie.UserContact("userContactResource", new()
    {
        Method = "string",
        To = "string",
        Username = "string",
        Enabled = false,
    });
    
    example, err := opsgenie.NewUserContact(ctx, "userContactResource", &opsgenie.UserContactArgs{
    	Method:   pulumi.String("string"),
    	To:       pulumi.String("string"),
    	Username: pulumi.String("string"),
    	Enabled:  pulumi.Bool(false),
    })
    
    var userContactResource = new UserContact("userContactResource", UserContactArgs.builder()
        .method("string")
        .to("string")
        .username("string")
        .enabled(false)
        .build());
    
    user_contact_resource = opsgenie.UserContact("userContactResource",
        method="string",
        to="string",
        username="string",
        enabled=False)
    
    const userContactResource = new opsgenie.UserContact("userContactResource", {
        method: "string",
        to: "string",
        username: "string",
        enabled: false,
    });
    
    type: opsgenie:UserContact
    properties:
        enabled: false
        method: string
        to: string
        username: string
    

    UserContact Resource Properties

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

    Inputs

    The UserContact resource accepts the following input properties:

    Method string
    This parameter is the contact method of user and should be one of email, sms or voice. Please note that adding mobile is not supported from API.
    To string
    to field is the address of given method.
    Username string
    The username for contact.(reference)
    Enabled bool
    Enable contact of the user in OpsGenie. Default value is true.
    Method string
    This parameter is the contact method of user and should be one of email, sms or voice. Please note that adding mobile is not supported from API.
    To string
    to field is the address of given method.
    Username string
    The username for contact.(reference)
    Enabled bool
    Enable contact of the user in OpsGenie. Default value is true.
    method String
    This parameter is the contact method of user and should be one of email, sms or voice. Please note that adding mobile is not supported from API.
    to String
    to field is the address of given method.
    username String
    The username for contact.(reference)
    enabled Boolean
    Enable contact of the user in OpsGenie. Default value is true.
    method string
    This parameter is the contact method of user and should be one of email, sms or voice. Please note that adding mobile is not supported from API.
    to string
    to field is the address of given method.
    username string
    The username for contact.(reference)
    enabled boolean
    Enable contact of the user in OpsGenie. Default value is true.
    method str
    This parameter is the contact method of user and should be one of email, sms or voice. Please note that adding mobile is not supported from API.
    to str
    to field is the address of given method.
    username str
    The username for contact.(reference)
    enabled bool
    Enable contact of the user in OpsGenie. Default value is true.
    method String
    This parameter is the contact method of user and should be one of email, sms or voice. Please note that adding mobile is not supported from API.
    to String
    to field is the address of given method.
    username String
    The username for contact.(reference)
    enabled Boolean
    Enable contact of the user in OpsGenie. Default value is true.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the UserContact 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 UserContact Resource

    Get an existing UserContact 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?: UserContactState, opts?: CustomResourceOptions): UserContact
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            enabled: Optional[bool] = None,
            method: Optional[str] = None,
            to: Optional[str] = None,
            username: Optional[str] = None) -> UserContact
    func GetUserContact(ctx *Context, name string, id IDInput, state *UserContactState, opts ...ResourceOption) (*UserContact, error)
    public static UserContact Get(string name, Input<string> id, UserContactState? state, CustomResourceOptions? opts = null)
    public static UserContact get(String name, Output<String> id, UserContactState 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:
    Enabled bool
    Enable contact of the user in OpsGenie. Default value is true.
    Method string
    This parameter is the contact method of user and should be one of email, sms or voice. Please note that adding mobile is not supported from API.
    To string
    to field is the address of given method.
    Username string
    The username for contact.(reference)
    Enabled bool
    Enable contact of the user in OpsGenie. Default value is true.
    Method string
    This parameter is the contact method of user and should be one of email, sms or voice. Please note that adding mobile is not supported from API.
    To string
    to field is the address of given method.
    Username string
    The username for contact.(reference)
    enabled Boolean
    Enable contact of the user in OpsGenie. Default value is true.
    method String
    This parameter is the contact method of user and should be one of email, sms or voice. Please note that adding mobile is not supported from API.
    to String
    to field is the address of given method.
    username String
    The username for contact.(reference)
    enabled boolean
    Enable contact of the user in OpsGenie. Default value is true.
    method string
    This parameter is the contact method of user and should be one of email, sms or voice. Please note that adding mobile is not supported from API.
    to string
    to field is the address of given method.
    username string
    The username for contact.(reference)
    enabled bool
    Enable contact of the user in OpsGenie. Default value is true.
    method str
    This parameter is the contact method of user and should be one of email, sms or voice. Please note that adding mobile is not supported from API.
    to str
    to field is the address of given method.
    username str
    The username for contact.(reference)
    enabled Boolean
    Enable contact of the user in OpsGenie. Default value is true.
    method String
    This parameter is the contact method of user and should be one of email, sms or voice. Please note that adding mobile is not supported from API.
    to String
    to field is the address of given method.
    username String
    The username for contact.(reference)

    Import

    Users can be imported using the username/contact_id, e.g.

    $ pulumi import opsgenie:index/userContact:UserContact testcontact username/contact_id`
    

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

    Package Details

    Repository
    Opsgenie pulumi/pulumi-opsgenie
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the opsgenie Terraform Provider.
    opsgenie logo
    Opsgenie v1.3.8 published on Monday, Jun 24, 2024 by Pulumi