github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/chime/sdkvoiceSipRule.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package chime
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // A SIP rule associates your SIP media application with a phone number or a Request URI hostname. You can associate a SIP rule with more than one SIP media application. Each application then runs only that rule.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/chime"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := chime.NewSdkvoiceSipRule(ctx, "example", &chime.SdkvoiceSipRuleArgs{
    35  //				Name:         pulumi.String("example-sip-rule"),
    36  //				TriggerType:  pulumi.String("RequestUriHostname"),
    37  //				TriggerValue: pulumi.Any(example_voice_connector.OutboundHostName),
    38  //				TargetApplications: chime.SdkvoiceSipRuleTargetApplicationArray{
    39  //					&chime.SdkvoiceSipRuleTargetApplicationArgs{
    40  //						Priority:              pulumi.Int(1),
    41  //						SipMediaApplicationId: pulumi.Any(example_sma.Id),
    42  //						AwsRegion:             pulumi.String("us-east-1"),
    43  //					},
    44  //				},
    45  //			})
    46  //			if err != nil {
    47  //				return err
    48  //			}
    49  //			return nil
    50  //		})
    51  //	}
    52  //
    53  // ```
    54  // <!--End PulumiCodeChooser -->
    55  //
    56  // ## Import
    57  //
    58  // Using `pulumi import`, import a ChimeSDKVoice SIP Rule using the `id`. For example:
    59  //
    60  // ```sh
    61  // $ pulumi import aws:chime/sdkvoiceSipRule:SdkvoiceSipRule example abcdef123456
    62  // ```
    63  type SdkvoiceSipRule struct {
    64  	pulumi.CustomResourceState
    65  
    66  	// Enables or disables a rule. You must disable rules before you can delete them.
    67  	Disabled pulumi.BoolPtrOutput `pulumi:"disabled"`
    68  	// The name of the SIP rule.
    69  	Name pulumi.StringOutput `pulumi:"name"`
    70  	// List of SIP media applications with priority and AWS Region. Only one SIP application per AWS Region can be used. See `targetApplications`.
    71  	TargetApplications SdkvoiceSipRuleTargetApplicationArrayOutput `pulumi:"targetApplications"`
    72  	// The type of trigger assigned to the SIP rule in `triggerValue`. Valid values are `RequestUriHostname` or `ToPhoneNumber`.
    73  	TriggerType pulumi.StringOutput `pulumi:"triggerType"`
    74  	// If `triggerType` is `RequestUriHostname`, the value can be the outbound host name of an Amazon Chime Voice Connector. If `triggerType` is `ToPhoneNumber`, the value can be a customer-owned phone number in the E164 format. The Sip Media Application specified in the Sip Rule is triggered if the request URI in an incoming SIP request matches the `RequestUriHostname`, or if the "To" header in the incoming SIP request matches the `ToPhoneNumber` value.
    75  	//
    76  	// The following arguments are optional:
    77  	TriggerValue pulumi.StringOutput `pulumi:"triggerValue"`
    78  }
    79  
    80  // NewSdkvoiceSipRule registers a new resource with the given unique name, arguments, and options.
    81  func NewSdkvoiceSipRule(ctx *pulumi.Context,
    82  	name string, args *SdkvoiceSipRuleArgs, opts ...pulumi.ResourceOption) (*SdkvoiceSipRule, error) {
    83  	if args == nil {
    84  		return nil, errors.New("missing one or more required arguments")
    85  	}
    86  
    87  	if args.TargetApplications == nil {
    88  		return nil, errors.New("invalid value for required argument 'TargetApplications'")
    89  	}
    90  	if args.TriggerType == nil {
    91  		return nil, errors.New("invalid value for required argument 'TriggerType'")
    92  	}
    93  	if args.TriggerValue == nil {
    94  		return nil, errors.New("invalid value for required argument 'TriggerValue'")
    95  	}
    96  	opts = internal.PkgResourceDefaultOpts(opts)
    97  	var resource SdkvoiceSipRule
    98  	err := ctx.RegisterResource("aws:chime/sdkvoiceSipRule:SdkvoiceSipRule", name, args, &resource, opts...)
    99  	if err != nil {
   100  		return nil, err
   101  	}
   102  	return &resource, nil
   103  }
   104  
   105  // GetSdkvoiceSipRule gets an existing SdkvoiceSipRule resource's state with the given name, ID, and optional
   106  // state properties that are used to uniquely qualify the lookup (nil if not required).
   107  func GetSdkvoiceSipRule(ctx *pulumi.Context,
   108  	name string, id pulumi.IDInput, state *SdkvoiceSipRuleState, opts ...pulumi.ResourceOption) (*SdkvoiceSipRule, error) {
   109  	var resource SdkvoiceSipRule
   110  	err := ctx.ReadResource("aws:chime/sdkvoiceSipRule:SdkvoiceSipRule", name, id, state, &resource, opts...)
   111  	if err != nil {
   112  		return nil, err
   113  	}
   114  	return &resource, nil
   115  }
   116  
   117  // Input properties used for looking up and filtering SdkvoiceSipRule resources.
   118  type sdkvoiceSipRuleState struct {
   119  	// Enables or disables a rule. You must disable rules before you can delete them.
   120  	Disabled *bool `pulumi:"disabled"`
   121  	// The name of the SIP rule.
   122  	Name *string `pulumi:"name"`
   123  	// List of SIP media applications with priority and AWS Region. Only one SIP application per AWS Region can be used. See `targetApplications`.
   124  	TargetApplications []SdkvoiceSipRuleTargetApplication `pulumi:"targetApplications"`
   125  	// The type of trigger assigned to the SIP rule in `triggerValue`. Valid values are `RequestUriHostname` or `ToPhoneNumber`.
   126  	TriggerType *string `pulumi:"triggerType"`
   127  	// If `triggerType` is `RequestUriHostname`, the value can be the outbound host name of an Amazon Chime Voice Connector. If `triggerType` is `ToPhoneNumber`, the value can be a customer-owned phone number in the E164 format. The Sip Media Application specified in the Sip Rule is triggered if the request URI in an incoming SIP request matches the `RequestUriHostname`, or if the "To" header in the incoming SIP request matches the `ToPhoneNumber` value.
   128  	//
   129  	// The following arguments are optional:
   130  	TriggerValue *string `pulumi:"triggerValue"`
   131  }
   132  
   133  type SdkvoiceSipRuleState struct {
   134  	// Enables or disables a rule. You must disable rules before you can delete them.
   135  	Disabled pulumi.BoolPtrInput
   136  	// The name of the SIP rule.
   137  	Name pulumi.StringPtrInput
   138  	// List of SIP media applications with priority and AWS Region. Only one SIP application per AWS Region can be used. See `targetApplications`.
   139  	TargetApplications SdkvoiceSipRuleTargetApplicationArrayInput
   140  	// The type of trigger assigned to the SIP rule in `triggerValue`. Valid values are `RequestUriHostname` or `ToPhoneNumber`.
   141  	TriggerType pulumi.StringPtrInput
   142  	// If `triggerType` is `RequestUriHostname`, the value can be the outbound host name of an Amazon Chime Voice Connector. If `triggerType` is `ToPhoneNumber`, the value can be a customer-owned phone number in the E164 format. The Sip Media Application specified in the Sip Rule is triggered if the request URI in an incoming SIP request matches the `RequestUriHostname`, or if the "To" header in the incoming SIP request matches the `ToPhoneNumber` value.
   143  	//
   144  	// The following arguments are optional:
   145  	TriggerValue pulumi.StringPtrInput
   146  }
   147  
   148  func (SdkvoiceSipRuleState) ElementType() reflect.Type {
   149  	return reflect.TypeOf((*sdkvoiceSipRuleState)(nil)).Elem()
   150  }
   151  
   152  type sdkvoiceSipRuleArgs struct {
   153  	// Enables or disables a rule. You must disable rules before you can delete them.
   154  	Disabled *bool `pulumi:"disabled"`
   155  	// The name of the SIP rule.
   156  	Name *string `pulumi:"name"`
   157  	// List of SIP media applications with priority and AWS Region. Only one SIP application per AWS Region can be used. See `targetApplications`.
   158  	TargetApplications []SdkvoiceSipRuleTargetApplication `pulumi:"targetApplications"`
   159  	// The type of trigger assigned to the SIP rule in `triggerValue`. Valid values are `RequestUriHostname` or `ToPhoneNumber`.
   160  	TriggerType string `pulumi:"triggerType"`
   161  	// If `triggerType` is `RequestUriHostname`, the value can be the outbound host name of an Amazon Chime Voice Connector. If `triggerType` is `ToPhoneNumber`, the value can be a customer-owned phone number in the E164 format. The Sip Media Application specified in the Sip Rule is triggered if the request URI in an incoming SIP request matches the `RequestUriHostname`, or if the "To" header in the incoming SIP request matches the `ToPhoneNumber` value.
   162  	//
   163  	// The following arguments are optional:
   164  	TriggerValue string `pulumi:"triggerValue"`
   165  }
   166  
   167  // The set of arguments for constructing a SdkvoiceSipRule resource.
   168  type SdkvoiceSipRuleArgs struct {
   169  	// Enables or disables a rule. You must disable rules before you can delete them.
   170  	Disabled pulumi.BoolPtrInput
   171  	// The name of the SIP rule.
   172  	Name pulumi.StringPtrInput
   173  	// List of SIP media applications with priority and AWS Region. Only one SIP application per AWS Region can be used. See `targetApplications`.
   174  	TargetApplications SdkvoiceSipRuleTargetApplicationArrayInput
   175  	// The type of trigger assigned to the SIP rule in `triggerValue`. Valid values are `RequestUriHostname` or `ToPhoneNumber`.
   176  	TriggerType pulumi.StringInput
   177  	// If `triggerType` is `RequestUriHostname`, the value can be the outbound host name of an Amazon Chime Voice Connector. If `triggerType` is `ToPhoneNumber`, the value can be a customer-owned phone number in the E164 format. The Sip Media Application specified in the Sip Rule is triggered if the request URI in an incoming SIP request matches the `RequestUriHostname`, or if the "To" header in the incoming SIP request matches the `ToPhoneNumber` value.
   178  	//
   179  	// The following arguments are optional:
   180  	TriggerValue pulumi.StringInput
   181  }
   182  
   183  func (SdkvoiceSipRuleArgs) ElementType() reflect.Type {
   184  	return reflect.TypeOf((*sdkvoiceSipRuleArgs)(nil)).Elem()
   185  }
   186  
   187  type SdkvoiceSipRuleInput interface {
   188  	pulumi.Input
   189  
   190  	ToSdkvoiceSipRuleOutput() SdkvoiceSipRuleOutput
   191  	ToSdkvoiceSipRuleOutputWithContext(ctx context.Context) SdkvoiceSipRuleOutput
   192  }
   193  
   194  func (*SdkvoiceSipRule) ElementType() reflect.Type {
   195  	return reflect.TypeOf((**SdkvoiceSipRule)(nil)).Elem()
   196  }
   197  
   198  func (i *SdkvoiceSipRule) ToSdkvoiceSipRuleOutput() SdkvoiceSipRuleOutput {
   199  	return i.ToSdkvoiceSipRuleOutputWithContext(context.Background())
   200  }
   201  
   202  func (i *SdkvoiceSipRule) ToSdkvoiceSipRuleOutputWithContext(ctx context.Context) SdkvoiceSipRuleOutput {
   203  	return pulumi.ToOutputWithContext(ctx, i).(SdkvoiceSipRuleOutput)
   204  }
   205  
   206  // SdkvoiceSipRuleArrayInput is an input type that accepts SdkvoiceSipRuleArray and SdkvoiceSipRuleArrayOutput values.
   207  // You can construct a concrete instance of `SdkvoiceSipRuleArrayInput` via:
   208  //
   209  //	SdkvoiceSipRuleArray{ SdkvoiceSipRuleArgs{...} }
   210  type SdkvoiceSipRuleArrayInput interface {
   211  	pulumi.Input
   212  
   213  	ToSdkvoiceSipRuleArrayOutput() SdkvoiceSipRuleArrayOutput
   214  	ToSdkvoiceSipRuleArrayOutputWithContext(context.Context) SdkvoiceSipRuleArrayOutput
   215  }
   216  
   217  type SdkvoiceSipRuleArray []SdkvoiceSipRuleInput
   218  
   219  func (SdkvoiceSipRuleArray) ElementType() reflect.Type {
   220  	return reflect.TypeOf((*[]*SdkvoiceSipRule)(nil)).Elem()
   221  }
   222  
   223  func (i SdkvoiceSipRuleArray) ToSdkvoiceSipRuleArrayOutput() SdkvoiceSipRuleArrayOutput {
   224  	return i.ToSdkvoiceSipRuleArrayOutputWithContext(context.Background())
   225  }
   226  
   227  func (i SdkvoiceSipRuleArray) ToSdkvoiceSipRuleArrayOutputWithContext(ctx context.Context) SdkvoiceSipRuleArrayOutput {
   228  	return pulumi.ToOutputWithContext(ctx, i).(SdkvoiceSipRuleArrayOutput)
   229  }
   230  
   231  // SdkvoiceSipRuleMapInput is an input type that accepts SdkvoiceSipRuleMap and SdkvoiceSipRuleMapOutput values.
   232  // You can construct a concrete instance of `SdkvoiceSipRuleMapInput` via:
   233  //
   234  //	SdkvoiceSipRuleMap{ "key": SdkvoiceSipRuleArgs{...} }
   235  type SdkvoiceSipRuleMapInput interface {
   236  	pulumi.Input
   237  
   238  	ToSdkvoiceSipRuleMapOutput() SdkvoiceSipRuleMapOutput
   239  	ToSdkvoiceSipRuleMapOutputWithContext(context.Context) SdkvoiceSipRuleMapOutput
   240  }
   241  
   242  type SdkvoiceSipRuleMap map[string]SdkvoiceSipRuleInput
   243  
   244  func (SdkvoiceSipRuleMap) ElementType() reflect.Type {
   245  	return reflect.TypeOf((*map[string]*SdkvoiceSipRule)(nil)).Elem()
   246  }
   247  
   248  func (i SdkvoiceSipRuleMap) ToSdkvoiceSipRuleMapOutput() SdkvoiceSipRuleMapOutput {
   249  	return i.ToSdkvoiceSipRuleMapOutputWithContext(context.Background())
   250  }
   251  
   252  func (i SdkvoiceSipRuleMap) ToSdkvoiceSipRuleMapOutputWithContext(ctx context.Context) SdkvoiceSipRuleMapOutput {
   253  	return pulumi.ToOutputWithContext(ctx, i).(SdkvoiceSipRuleMapOutput)
   254  }
   255  
   256  type SdkvoiceSipRuleOutput struct{ *pulumi.OutputState }
   257  
   258  func (SdkvoiceSipRuleOutput) ElementType() reflect.Type {
   259  	return reflect.TypeOf((**SdkvoiceSipRule)(nil)).Elem()
   260  }
   261  
   262  func (o SdkvoiceSipRuleOutput) ToSdkvoiceSipRuleOutput() SdkvoiceSipRuleOutput {
   263  	return o
   264  }
   265  
   266  func (o SdkvoiceSipRuleOutput) ToSdkvoiceSipRuleOutputWithContext(ctx context.Context) SdkvoiceSipRuleOutput {
   267  	return o
   268  }
   269  
   270  // Enables or disables a rule. You must disable rules before you can delete them.
   271  func (o SdkvoiceSipRuleOutput) Disabled() pulumi.BoolPtrOutput {
   272  	return o.ApplyT(func(v *SdkvoiceSipRule) pulumi.BoolPtrOutput { return v.Disabled }).(pulumi.BoolPtrOutput)
   273  }
   274  
   275  // The name of the SIP rule.
   276  func (o SdkvoiceSipRuleOutput) Name() pulumi.StringOutput {
   277  	return o.ApplyT(func(v *SdkvoiceSipRule) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   278  }
   279  
   280  // List of SIP media applications with priority and AWS Region. Only one SIP application per AWS Region can be used. See `targetApplications`.
   281  func (o SdkvoiceSipRuleOutput) TargetApplications() SdkvoiceSipRuleTargetApplicationArrayOutput {
   282  	return o.ApplyT(func(v *SdkvoiceSipRule) SdkvoiceSipRuleTargetApplicationArrayOutput { return v.TargetApplications }).(SdkvoiceSipRuleTargetApplicationArrayOutput)
   283  }
   284  
   285  // The type of trigger assigned to the SIP rule in `triggerValue`. Valid values are `RequestUriHostname` or `ToPhoneNumber`.
   286  func (o SdkvoiceSipRuleOutput) TriggerType() pulumi.StringOutput {
   287  	return o.ApplyT(func(v *SdkvoiceSipRule) pulumi.StringOutput { return v.TriggerType }).(pulumi.StringOutput)
   288  }
   289  
   290  // If `triggerType` is `RequestUriHostname`, the value can be the outbound host name of an Amazon Chime Voice Connector. If `triggerType` is `ToPhoneNumber`, the value can be a customer-owned phone number in the E164 format. The Sip Media Application specified in the Sip Rule is triggered if the request URI in an incoming SIP request matches the `RequestUriHostname`, or if the "To" header in the incoming SIP request matches the `ToPhoneNumber` value.
   291  //
   292  // The following arguments are optional:
   293  func (o SdkvoiceSipRuleOutput) TriggerValue() pulumi.StringOutput {
   294  	return o.ApplyT(func(v *SdkvoiceSipRule) pulumi.StringOutput { return v.TriggerValue }).(pulumi.StringOutput)
   295  }
   296  
   297  type SdkvoiceSipRuleArrayOutput struct{ *pulumi.OutputState }
   298  
   299  func (SdkvoiceSipRuleArrayOutput) ElementType() reflect.Type {
   300  	return reflect.TypeOf((*[]*SdkvoiceSipRule)(nil)).Elem()
   301  }
   302  
   303  func (o SdkvoiceSipRuleArrayOutput) ToSdkvoiceSipRuleArrayOutput() SdkvoiceSipRuleArrayOutput {
   304  	return o
   305  }
   306  
   307  func (o SdkvoiceSipRuleArrayOutput) ToSdkvoiceSipRuleArrayOutputWithContext(ctx context.Context) SdkvoiceSipRuleArrayOutput {
   308  	return o
   309  }
   310  
   311  func (o SdkvoiceSipRuleArrayOutput) Index(i pulumi.IntInput) SdkvoiceSipRuleOutput {
   312  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SdkvoiceSipRule {
   313  		return vs[0].([]*SdkvoiceSipRule)[vs[1].(int)]
   314  	}).(SdkvoiceSipRuleOutput)
   315  }
   316  
   317  type SdkvoiceSipRuleMapOutput struct{ *pulumi.OutputState }
   318  
   319  func (SdkvoiceSipRuleMapOutput) ElementType() reflect.Type {
   320  	return reflect.TypeOf((*map[string]*SdkvoiceSipRule)(nil)).Elem()
   321  }
   322  
   323  func (o SdkvoiceSipRuleMapOutput) ToSdkvoiceSipRuleMapOutput() SdkvoiceSipRuleMapOutput {
   324  	return o
   325  }
   326  
   327  func (o SdkvoiceSipRuleMapOutput) ToSdkvoiceSipRuleMapOutputWithContext(ctx context.Context) SdkvoiceSipRuleMapOutput {
   328  	return o
   329  }
   330  
   331  func (o SdkvoiceSipRuleMapOutput) MapIndex(k pulumi.StringInput) SdkvoiceSipRuleOutput {
   332  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SdkvoiceSipRule {
   333  		return vs[0].(map[string]*SdkvoiceSipRule)[vs[1].(string)]
   334  	}).(SdkvoiceSipRuleOutput)
   335  }
   336  
   337  func init() {
   338  	pulumi.RegisterInputType(reflect.TypeOf((*SdkvoiceSipRuleInput)(nil)).Elem(), &SdkvoiceSipRule{})
   339  	pulumi.RegisterInputType(reflect.TypeOf((*SdkvoiceSipRuleArrayInput)(nil)).Elem(), SdkvoiceSipRuleArray{})
   340  	pulumi.RegisterInputType(reflect.TypeOf((*SdkvoiceSipRuleMapInput)(nil)).Elem(), SdkvoiceSipRuleMap{})
   341  	pulumi.RegisterOutputType(SdkvoiceSipRuleOutput{})
   342  	pulumi.RegisterOutputType(SdkvoiceSipRuleArrayOutput{})
   343  	pulumi.RegisterOutputType(SdkvoiceSipRuleMapOutput{})
   344  }