github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iot/loggingOptions.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 iot
     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  // Provides a resource to manage [default logging options](https://docs.aws.amazon.com/iot/latest/developerguide/configure-logging.html#configure-logging-console).
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iot"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := iot.NewLoggingOptions(ctx, "example", &iot.LoggingOptionsArgs{
    33  //				DefaultLogLevel: pulumi.String("WARN"),
    34  //				RoleArn:         pulumi.Any(exampleAwsIamRole.Arn),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  type LoggingOptions struct {
    46  	pulumi.CustomResourceState
    47  
    48  	// The default logging level. Valid Values: `"DEBUG"`, `"INFO"`, `"ERROR"`, `"WARN"`, `"DISABLED"`.
    49  	DefaultLogLevel pulumi.StringOutput `pulumi:"defaultLogLevel"`
    50  	// If `true` all logs are disabled. The default is `false`.
    51  	DisableAllLogs pulumi.BoolPtrOutput `pulumi:"disableAllLogs"`
    52  	// The ARN of the role that allows IoT to write to Cloudwatch logs.
    53  	RoleArn pulumi.StringOutput `pulumi:"roleArn"`
    54  }
    55  
    56  // NewLoggingOptions registers a new resource with the given unique name, arguments, and options.
    57  func NewLoggingOptions(ctx *pulumi.Context,
    58  	name string, args *LoggingOptionsArgs, opts ...pulumi.ResourceOption) (*LoggingOptions, error) {
    59  	if args == nil {
    60  		return nil, errors.New("missing one or more required arguments")
    61  	}
    62  
    63  	if args.DefaultLogLevel == nil {
    64  		return nil, errors.New("invalid value for required argument 'DefaultLogLevel'")
    65  	}
    66  	if args.RoleArn == nil {
    67  		return nil, errors.New("invalid value for required argument 'RoleArn'")
    68  	}
    69  	opts = internal.PkgResourceDefaultOpts(opts)
    70  	var resource LoggingOptions
    71  	err := ctx.RegisterResource("aws:iot/loggingOptions:LoggingOptions", name, args, &resource, opts...)
    72  	if err != nil {
    73  		return nil, err
    74  	}
    75  	return &resource, nil
    76  }
    77  
    78  // GetLoggingOptions gets an existing LoggingOptions resource's state with the given name, ID, and optional
    79  // state properties that are used to uniquely qualify the lookup (nil if not required).
    80  func GetLoggingOptions(ctx *pulumi.Context,
    81  	name string, id pulumi.IDInput, state *LoggingOptionsState, opts ...pulumi.ResourceOption) (*LoggingOptions, error) {
    82  	var resource LoggingOptions
    83  	err := ctx.ReadResource("aws:iot/loggingOptions:LoggingOptions", name, id, state, &resource, opts...)
    84  	if err != nil {
    85  		return nil, err
    86  	}
    87  	return &resource, nil
    88  }
    89  
    90  // Input properties used for looking up and filtering LoggingOptions resources.
    91  type loggingOptionsState struct {
    92  	// The default logging level. Valid Values: `"DEBUG"`, `"INFO"`, `"ERROR"`, `"WARN"`, `"DISABLED"`.
    93  	DefaultLogLevel *string `pulumi:"defaultLogLevel"`
    94  	// If `true` all logs are disabled. The default is `false`.
    95  	DisableAllLogs *bool `pulumi:"disableAllLogs"`
    96  	// The ARN of the role that allows IoT to write to Cloudwatch logs.
    97  	RoleArn *string `pulumi:"roleArn"`
    98  }
    99  
   100  type LoggingOptionsState struct {
   101  	// The default logging level. Valid Values: `"DEBUG"`, `"INFO"`, `"ERROR"`, `"WARN"`, `"DISABLED"`.
   102  	DefaultLogLevel pulumi.StringPtrInput
   103  	// If `true` all logs are disabled. The default is `false`.
   104  	DisableAllLogs pulumi.BoolPtrInput
   105  	// The ARN of the role that allows IoT to write to Cloudwatch logs.
   106  	RoleArn pulumi.StringPtrInput
   107  }
   108  
   109  func (LoggingOptionsState) ElementType() reflect.Type {
   110  	return reflect.TypeOf((*loggingOptionsState)(nil)).Elem()
   111  }
   112  
   113  type loggingOptionsArgs struct {
   114  	// The default logging level. Valid Values: `"DEBUG"`, `"INFO"`, `"ERROR"`, `"WARN"`, `"DISABLED"`.
   115  	DefaultLogLevel string `pulumi:"defaultLogLevel"`
   116  	// If `true` all logs are disabled. The default is `false`.
   117  	DisableAllLogs *bool `pulumi:"disableAllLogs"`
   118  	// The ARN of the role that allows IoT to write to Cloudwatch logs.
   119  	RoleArn string `pulumi:"roleArn"`
   120  }
   121  
   122  // The set of arguments for constructing a LoggingOptions resource.
   123  type LoggingOptionsArgs struct {
   124  	// The default logging level. Valid Values: `"DEBUG"`, `"INFO"`, `"ERROR"`, `"WARN"`, `"DISABLED"`.
   125  	DefaultLogLevel pulumi.StringInput
   126  	// If `true` all logs are disabled. The default is `false`.
   127  	DisableAllLogs pulumi.BoolPtrInput
   128  	// The ARN of the role that allows IoT to write to Cloudwatch logs.
   129  	RoleArn pulumi.StringInput
   130  }
   131  
   132  func (LoggingOptionsArgs) ElementType() reflect.Type {
   133  	return reflect.TypeOf((*loggingOptionsArgs)(nil)).Elem()
   134  }
   135  
   136  type LoggingOptionsInput interface {
   137  	pulumi.Input
   138  
   139  	ToLoggingOptionsOutput() LoggingOptionsOutput
   140  	ToLoggingOptionsOutputWithContext(ctx context.Context) LoggingOptionsOutput
   141  }
   142  
   143  func (*LoggingOptions) ElementType() reflect.Type {
   144  	return reflect.TypeOf((**LoggingOptions)(nil)).Elem()
   145  }
   146  
   147  func (i *LoggingOptions) ToLoggingOptionsOutput() LoggingOptionsOutput {
   148  	return i.ToLoggingOptionsOutputWithContext(context.Background())
   149  }
   150  
   151  func (i *LoggingOptions) ToLoggingOptionsOutputWithContext(ctx context.Context) LoggingOptionsOutput {
   152  	return pulumi.ToOutputWithContext(ctx, i).(LoggingOptionsOutput)
   153  }
   154  
   155  // LoggingOptionsArrayInput is an input type that accepts LoggingOptionsArray and LoggingOptionsArrayOutput values.
   156  // You can construct a concrete instance of `LoggingOptionsArrayInput` via:
   157  //
   158  //	LoggingOptionsArray{ LoggingOptionsArgs{...} }
   159  type LoggingOptionsArrayInput interface {
   160  	pulumi.Input
   161  
   162  	ToLoggingOptionsArrayOutput() LoggingOptionsArrayOutput
   163  	ToLoggingOptionsArrayOutputWithContext(context.Context) LoggingOptionsArrayOutput
   164  }
   165  
   166  type LoggingOptionsArray []LoggingOptionsInput
   167  
   168  func (LoggingOptionsArray) ElementType() reflect.Type {
   169  	return reflect.TypeOf((*[]*LoggingOptions)(nil)).Elem()
   170  }
   171  
   172  func (i LoggingOptionsArray) ToLoggingOptionsArrayOutput() LoggingOptionsArrayOutput {
   173  	return i.ToLoggingOptionsArrayOutputWithContext(context.Background())
   174  }
   175  
   176  func (i LoggingOptionsArray) ToLoggingOptionsArrayOutputWithContext(ctx context.Context) LoggingOptionsArrayOutput {
   177  	return pulumi.ToOutputWithContext(ctx, i).(LoggingOptionsArrayOutput)
   178  }
   179  
   180  // LoggingOptionsMapInput is an input type that accepts LoggingOptionsMap and LoggingOptionsMapOutput values.
   181  // You can construct a concrete instance of `LoggingOptionsMapInput` via:
   182  //
   183  //	LoggingOptionsMap{ "key": LoggingOptionsArgs{...} }
   184  type LoggingOptionsMapInput interface {
   185  	pulumi.Input
   186  
   187  	ToLoggingOptionsMapOutput() LoggingOptionsMapOutput
   188  	ToLoggingOptionsMapOutputWithContext(context.Context) LoggingOptionsMapOutput
   189  }
   190  
   191  type LoggingOptionsMap map[string]LoggingOptionsInput
   192  
   193  func (LoggingOptionsMap) ElementType() reflect.Type {
   194  	return reflect.TypeOf((*map[string]*LoggingOptions)(nil)).Elem()
   195  }
   196  
   197  func (i LoggingOptionsMap) ToLoggingOptionsMapOutput() LoggingOptionsMapOutput {
   198  	return i.ToLoggingOptionsMapOutputWithContext(context.Background())
   199  }
   200  
   201  func (i LoggingOptionsMap) ToLoggingOptionsMapOutputWithContext(ctx context.Context) LoggingOptionsMapOutput {
   202  	return pulumi.ToOutputWithContext(ctx, i).(LoggingOptionsMapOutput)
   203  }
   204  
   205  type LoggingOptionsOutput struct{ *pulumi.OutputState }
   206  
   207  func (LoggingOptionsOutput) ElementType() reflect.Type {
   208  	return reflect.TypeOf((**LoggingOptions)(nil)).Elem()
   209  }
   210  
   211  func (o LoggingOptionsOutput) ToLoggingOptionsOutput() LoggingOptionsOutput {
   212  	return o
   213  }
   214  
   215  func (o LoggingOptionsOutput) ToLoggingOptionsOutputWithContext(ctx context.Context) LoggingOptionsOutput {
   216  	return o
   217  }
   218  
   219  // The default logging level. Valid Values: `"DEBUG"`, `"INFO"`, `"ERROR"`, `"WARN"`, `"DISABLED"`.
   220  func (o LoggingOptionsOutput) DefaultLogLevel() pulumi.StringOutput {
   221  	return o.ApplyT(func(v *LoggingOptions) pulumi.StringOutput { return v.DefaultLogLevel }).(pulumi.StringOutput)
   222  }
   223  
   224  // If `true` all logs are disabled. The default is `false`.
   225  func (o LoggingOptionsOutput) DisableAllLogs() pulumi.BoolPtrOutput {
   226  	return o.ApplyT(func(v *LoggingOptions) pulumi.BoolPtrOutput { return v.DisableAllLogs }).(pulumi.BoolPtrOutput)
   227  }
   228  
   229  // The ARN of the role that allows IoT to write to Cloudwatch logs.
   230  func (o LoggingOptionsOutput) RoleArn() pulumi.StringOutput {
   231  	return o.ApplyT(func(v *LoggingOptions) pulumi.StringOutput { return v.RoleArn }).(pulumi.StringOutput)
   232  }
   233  
   234  type LoggingOptionsArrayOutput struct{ *pulumi.OutputState }
   235  
   236  func (LoggingOptionsArrayOutput) ElementType() reflect.Type {
   237  	return reflect.TypeOf((*[]*LoggingOptions)(nil)).Elem()
   238  }
   239  
   240  func (o LoggingOptionsArrayOutput) ToLoggingOptionsArrayOutput() LoggingOptionsArrayOutput {
   241  	return o
   242  }
   243  
   244  func (o LoggingOptionsArrayOutput) ToLoggingOptionsArrayOutputWithContext(ctx context.Context) LoggingOptionsArrayOutput {
   245  	return o
   246  }
   247  
   248  func (o LoggingOptionsArrayOutput) Index(i pulumi.IntInput) LoggingOptionsOutput {
   249  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *LoggingOptions {
   250  		return vs[0].([]*LoggingOptions)[vs[1].(int)]
   251  	}).(LoggingOptionsOutput)
   252  }
   253  
   254  type LoggingOptionsMapOutput struct{ *pulumi.OutputState }
   255  
   256  func (LoggingOptionsMapOutput) ElementType() reflect.Type {
   257  	return reflect.TypeOf((*map[string]*LoggingOptions)(nil)).Elem()
   258  }
   259  
   260  func (o LoggingOptionsMapOutput) ToLoggingOptionsMapOutput() LoggingOptionsMapOutput {
   261  	return o
   262  }
   263  
   264  func (o LoggingOptionsMapOutput) ToLoggingOptionsMapOutputWithContext(ctx context.Context) LoggingOptionsMapOutput {
   265  	return o
   266  }
   267  
   268  func (o LoggingOptionsMapOutput) MapIndex(k pulumi.StringInput) LoggingOptionsOutput {
   269  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *LoggingOptions {
   270  		return vs[0].(map[string]*LoggingOptions)[vs[1].(string)]
   271  	}).(LoggingOptionsOutput)
   272  }
   273  
   274  func init() {
   275  	pulumi.RegisterInputType(reflect.TypeOf((*LoggingOptionsInput)(nil)).Elem(), &LoggingOptions{})
   276  	pulumi.RegisterInputType(reflect.TypeOf((*LoggingOptionsArrayInput)(nil)).Elem(), LoggingOptionsArray{})
   277  	pulumi.RegisterInputType(reflect.TypeOf((*LoggingOptionsMapInput)(nil)).Elem(), LoggingOptionsMap{})
   278  	pulumi.RegisterOutputType(LoggingOptionsOutput{})
   279  	pulumi.RegisterOutputType(LoggingOptionsArrayOutput{})
   280  	pulumi.RegisterOutputType(LoggingOptionsMapOutput{})
   281  }