github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/auditmanager/assessment.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 auditmanager
     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  // Resource for managing an AWS Audit Manager Assessment.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"fmt"
    28  //
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/auditmanager"
    30  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    31  //
    32  // )
    33  //
    34  //	func main() {
    35  //		pulumi.Run(func(ctx *pulumi.Context) error {
    36  //			_, err := auditmanager.NewAssessment(ctx, "test", &auditmanager.AssessmentArgs{
    37  //				Name: pulumi.String("example"),
    38  //				AssessmentReportsDestination: &auditmanager.AssessmentAssessmentReportsDestinationArgs{
    39  //					Destination:     pulumi.String(fmt.Sprintf("s3://%v", testAwsS3Bucket.Id)),
    40  //					DestinationType: pulumi.String("S3"),
    41  //				},
    42  //				FrameworkId: pulumi.Any(testAwsAuditmanagerFramework.Id),
    43  //				Roles: auditmanager.AssessmentRoleArray{
    44  //					&auditmanager.AssessmentRoleArgs{
    45  //						RoleArn:  pulumi.Any(testAwsIamRole.Arn),
    46  //						RoleType: pulumi.String("PROCESS_OWNER"),
    47  //					},
    48  //				},
    49  //				Scope: &auditmanager.AssessmentScopeArgs{
    50  //					AwsAccounts: auditmanager.AssessmentScopeAwsAccountArray{
    51  //						&auditmanager.AssessmentScopeAwsAccountArgs{
    52  //							Id: pulumi.Any(current.AccountId),
    53  //						},
    54  //					},
    55  //					AwsServices: auditmanager.AssessmentScopeAwsServiceArray{
    56  //						&auditmanager.AssessmentScopeAwsServiceArgs{
    57  //							ServiceName: pulumi.String("S3"),
    58  //						},
    59  //					},
    60  //				},
    61  //			})
    62  //			if err != nil {
    63  //				return err
    64  //			}
    65  //			return nil
    66  //		})
    67  //	}
    68  //
    69  // ```
    70  // <!--End PulumiCodeChooser -->
    71  //
    72  // ## Import
    73  //
    74  // Using `pulumi import`, import Audit Manager Assessments using the assessment `id`. For example:
    75  //
    76  // ```sh
    77  // $ pulumi import aws:auditmanager/assessment:Assessment example abc123-de45
    78  // ```
    79  type Assessment struct {
    80  	pulumi.CustomResourceState
    81  
    82  	// Amazon Resource Name (ARN) of the assessment.
    83  	Arn pulumi.StringOutput `pulumi:"arn"`
    84  	// Assessment report storage destination configuration. See `assessmentReportsDestination` below.
    85  	AssessmentReportsDestination AssessmentAssessmentReportsDestinationPtrOutput `pulumi:"assessmentReportsDestination"`
    86  	// Description of the assessment.
    87  	Description pulumi.StringPtrOutput `pulumi:"description"`
    88  	// Unique identifier of the framework the assessment will be created from.
    89  	FrameworkId pulumi.StringOutput `pulumi:"frameworkId"`
    90  	// Name of the assessment.
    91  	Name pulumi.StringOutput `pulumi:"name"`
    92  	// List of roles for the assessment. See `roles` below.
    93  	Roles AssessmentRoleArrayOutput `pulumi:"roles"`
    94  	// Complete list of all roles with access to the assessment. This includes both roles explicitly configured via the `roles` block, and any roles which have access to all Audit Manager assessments by default.
    95  	RolesAlls AssessmentRolesAllArrayOutput `pulumi:"rolesAlls"`
    96  	// Amazon Web Services accounts and services that are in scope for the assessment. See `scope` below.
    97  	//
    98  	// The following arguments are optional:
    99  	Scope AssessmentScopePtrOutput `pulumi:"scope"`
   100  	// Status of the assessment. Valid values are `ACTIVE` and `INACTIVE`.
   101  	Status pulumi.StringOutput `pulumi:"status"`
   102  	// A map of tags to assign to the assessment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   103  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   104  	// Deprecated: Please use `tags` instead.
   105  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   106  }
   107  
   108  // NewAssessment registers a new resource with the given unique name, arguments, and options.
   109  func NewAssessment(ctx *pulumi.Context,
   110  	name string, args *AssessmentArgs, opts ...pulumi.ResourceOption) (*Assessment, error) {
   111  	if args == nil {
   112  		return nil, errors.New("missing one or more required arguments")
   113  	}
   114  
   115  	if args.FrameworkId == nil {
   116  		return nil, errors.New("invalid value for required argument 'FrameworkId'")
   117  	}
   118  	if args.Roles == nil {
   119  		return nil, errors.New("invalid value for required argument 'Roles'")
   120  	}
   121  	opts = internal.PkgResourceDefaultOpts(opts)
   122  	var resource Assessment
   123  	err := ctx.RegisterResource("aws:auditmanager/assessment:Assessment", name, args, &resource, opts...)
   124  	if err != nil {
   125  		return nil, err
   126  	}
   127  	return &resource, nil
   128  }
   129  
   130  // GetAssessment gets an existing Assessment resource's state with the given name, ID, and optional
   131  // state properties that are used to uniquely qualify the lookup (nil if not required).
   132  func GetAssessment(ctx *pulumi.Context,
   133  	name string, id pulumi.IDInput, state *AssessmentState, opts ...pulumi.ResourceOption) (*Assessment, error) {
   134  	var resource Assessment
   135  	err := ctx.ReadResource("aws:auditmanager/assessment:Assessment", name, id, state, &resource, opts...)
   136  	if err != nil {
   137  		return nil, err
   138  	}
   139  	return &resource, nil
   140  }
   141  
   142  // Input properties used for looking up and filtering Assessment resources.
   143  type assessmentState struct {
   144  	// Amazon Resource Name (ARN) of the assessment.
   145  	Arn *string `pulumi:"arn"`
   146  	// Assessment report storage destination configuration. See `assessmentReportsDestination` below.
   147  	AssessmentReportsDestination *AssessmentAssessmentReportsDestination `pulumi:"assessmentReportsDestination"`
   148  	// Description of the assessment.
   149  	Description *string `pulumi:"description"`
   150  	// Unique identifier of the framework the assessment will be created from.
   151  	FrameworkId *string `pulumi:"frameworkId"`
   152  	// Name of the assessment.
   153  	Name *string `pulumi:"name"`
   154  	// List of roles for the assessment. See `roles` below.
   155  	Roles []AssessmentRole `pulumi:"roles"`
   156  	// Complete list of all roles with access to the assessment. This includes both roles explicitly configured via the `roles` block, and any roles which have access to all Audit Manager assessments by default.
   157  	RolesAlls []AssessmentRolesAll `pulumi:"rolesAlls"`
   158  	// Amazon Web Services accounts and services that are in scope for the assessment. See `scope` below.
   159  	//
   160  	// The following arguments are optional:
   161  	Scope *AssessmentScope `pulumi:"scope"`
   162  	// Status of the assessment. Valid values are `ACTIVE` and `INACTIVE`.
   163  	Status *string `pulumi:"status"`
   164  	// A map of tags to assign to the assessment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   165  	Tags map[string]string `pulumi:"tags"`
   166  	// Deprecated: Please use `tags` instead.
   167  	TagsAll map[string]string `pulumi:"tagsAll"`
   168  }
   169  
   170  type AssessmentState struct {
   171  	// Amazon Resource Name (ARN) of the assessment.
   172  	Arn pulumi.StringPtrInput
   173  	// Assessment report storage destination configuration. See `assessmentReportsDestination` below.
   174  	AssessmentReportsDestination AssessmentAssessmentReportsDestinationPtrInput
   175  	// Description of the assessment.
   176  	Description pulumi.StringPtrInput
   177  	// Unique identifier of the framework the assessment will be created from.
   178  	FrameworkId pulumi.StringPtrInput
   179  	// Name of the assessment.
   180  	Name pulumi.StringPtrInput
   181  	// List of roles for the assessment. See `roles` below.
   182  	Roles AssessmentRoleArrayInput
   183  	// Complete list of all roles with access to the assessment. This includes both roles explicitly configured via the `roles` block, and any roles which have access to all Audit Manager assessments by default.
   184  	RolesAlls AssessmentRolesAllArrayInput
   185  	// Amazon Web Services accounts and services that are in scope for the assessment. See `scope` below.
   186  	//
   187  	// The following arguments are optional:
   188  	Scope AssessmentScopePtrInput
   189  	// Status of the assessment. Valid values are `ACTIVE` and `INACTIVE`.
   190  	Status pulumi.StringPtrInput
   191  	// A map of tags to assign to the assessment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   192  	Tags pulumi.StringMapInput
   193  	// Deprecated: Please use `tags` instead.
   194  	TagsAll pulumi.StringMapInput
   195  }
   196  
   197  func (AssessmentState) ElementType() reflect.Type {
   198  	return reflect.TypeOf((*assessmentState)(nil)).Elem()
   199  }
   200  
   201  type assessmentArgs struct {
   202  	// Assessment report storage destination configuration. See `assessmentReportsDestination` below.
   203  	AssessmentReportsDestination *AssessmentAssessmentReportsDestination `pulumi:"assessmentReportsDestination"`
   204  	// Description of the assessment.
   205  	Description *string `pulumi:"description"`
   206  	// Unique identifier of the framework the assessment will be created from.
   207  	FrameworkId string `pulumi:"frameworkId"`
   208  	// Name of the assessment.
   209  	Name *string `pulumi:"name"`
   210  	// List of roles for the assessment. See `roles` below.
   211  	Roles []AssessmentRole `pulumi:"roles"`
   212  	// Amazon Web Services accounts and services that are in scope for the assessment. See `scope` below.
   213  	//
   214  	// The following arguments are optional:
   215  	Scope *AssessmentScope `pulumi:"scope"`
   216  	// A map of tags to assign to the assessment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   217  	Tags map[string]string `pulumi:"tags"`
   218  }
   219  
   220  // The set of arguments for constructing a Assessment resource.
   221  type AssessmentArgs struct {
   222  	// Assessment report storage destination configuration. See `assessmentReportsDestination` below.
   223  	AssessmentReportsDestination AssessmentAssessmentReportsDestinationPtrInput
   224  	// Description of the assessment.
   225  	Description pulumi.StringPtrInput
   226  	// Unique identifier of the framework the assessment will be created from.
   227  	FrameworkId pulumi.StringInput
   228  	// Name of the assessment.
   229  	Name pulumi.StringPtrInput
   230  	// List of roles for the assessment. See `roles` below.
   231  	Roles AssessmentRoleArrayInput
   232  	// Amazon Web Services accounts and services that are in scope for the assessment. See `scope` below.
   233  	//
   234  	// The following arguments are optional:
   235  	Scope AssessmentScopePtrInput
   236  	// A map of tags to assign to the assessment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   237  	Tags pulumi.StringMapInput
   238  }
   239  
   240  func (AssessmentArgs) ElementType() reflect.Type {
   241  	return reflect.TypeOf((*assessmentArgs)(nil)).Elem()
   242  }
   243  
   244  type AssessmentInput interface {
   245  	pulumi.Input
   246  
   247  	ToAssessmentOutput() AssessmentOutput
   248  	ToAssessmentOutputWithContext(ctx context.Context) AssessmentOutput
   249  }
   250  
   251  func (*Assessment) ElementType() reflect.Type {
   252  	return reflect.TypeOf((**Assessment)(nil)).Elem()
   253  }
   254  
   255  func (i *Assessment) ToAssessmentOutput() AssessmentOutput {
   256  	return i.ToAssessmentOutputWithContext(context.Background())
   257  }
   258  
   259  func (i *Assessment) ToAssessmentOutputWithContext(ctx context.Context) AssessmentOutput {
   260  	return pulumi.ToOutputWithContext(ctx, i).(AssessmentOutput)
   261  }
   262  
   263  // AssessmentArrayInput is an input type that accepts AssessmentArray and AssessmentArrayOutput values.
   264  // You can construct a concrete instance of `AssessmentArrayInput` via:
   265  //
   266  //	AssessmentArray{ AssessmentArgs{...} }
   267  type AssessmentArrayInput interface {
   268  	pulumi.Input
   269  
   270  	ToAssessmentArrayOutput() AssessmentArrayOutput
   271  	ToAssessmentArrayOutputWithContext(context.Context) AssessmentArrayOutput
   272  }
   273  
   274  type AssessmentArray []AssessmentInput
   275  
   276  func (AssessmentArray) ElementType() reflect.Type {
   277  	return reflect.TypeOf((*[]*Assessment)(nil)).Elem()
   278  }
   279  
   280  func (i AssessmentArray) ToAssessmentArrayOutput() AssessmentArrayOutput {
   281  	return i.ToAssessmentArrayOutputWithContext(context.Background())
   282  }
   283  
   284  func (i AssessmentArray) ToAssessmentArrayOutputWithContext(ctx context.Context) AssessmentArrayOutput {
   285  	return pulumi.ToOutputWithContext(ctx, i).(AssessmentArrayOutput)
   286  }
   287  
   288  // AssessmentMapInput is an input type that accepts AssessmentMap and AssessmentMapOutput values.
   289  // You can construct a concrete instance of `AssessmentMapInput` via:
   290  //
   291  //	AssessmentMap{ "key": AssessmentArgs{...} }
   292  type AssessmentMapInput interface {
   293  	pulumi.Input
   294  
   295  	ToAssessmentMapOutput() AssessmentMapOutput
   296  	ToAssessmentMapOutputWithContext(context.Context) AssessmentMapOutput
   297  }
   298  
   299  type AssessmentMap map[string]AssessmentInput
   300  
   301  func (AssessmentMap) ElementType() reflect.Type {
   302  	return reflect.TypeOf((*map[string]*Assessment)(nil)).Elem()
   303  }
   304  
   305  func (i AssessmentMap) ToAssessmentMapOutput() AssessmentMapOutput {
   306  	return i.ToAssessmentMapOutputWithContext(context.Background())
   307  }
   308  
   309  func (i AssessmentMap) ToAssessmentMapOutputWithContext(ctx context.Context) AssessmentMapOutput {
   310  	return pulumi.ToOutputWithContext(ctx, i).(AssessmentMapOutput)
   311  }
   312  
   313  type AssessmentOutput struct{ *pulumi.OutputState }
   314  
   315  func (AssessmentOutput) ElementType() reflect.Type {
   316  	return reflect.TypeOf((**Assessment)(nil)).Elem()
   317  }
   318  
   319  func (o AssessmentOutput) ToAssessmentOutput() AssessmentOutput {
   320  	return o
   321  }
   322  
   323  func (o AssessmentOutput) ToAssessmentOutputWithContext(ctx context.Context) AssessmentOutput {
   324  	return o
   325  }
   326  
   327  // Amazon Resource Name (ARN) of the assessment.
   328  func (o AssessmentOutput) Arn() pulumi.StringOutput {
   329  	return o.ApplyT(func(v *Assessment) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   330  }
   331  
   332  // Assessment report storage destination configuration. See `assessmentReportsDestination` below.
   333  func (o AssessmentOutput) AssessmentReportsDestination() AssessmentAssessmentReportsDestinationPtrOutput {
   334  	return o.ApplyT(func(v *Assessment) AssessmentAssessmentReportsDestinationPtrOutput {
   335  		return v.AssessmentReportsDestination
   336  	}).(AssessmentAssessmentReportsDestinationPtrOutput)
   337  }
   338  
   339  // Description of the assessment.
   340  func (o AssessmentOutput) Description() pulumi.StringPtrOutput {
   341  	return o.ApplyT(func(v *Assessment) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   342  }
   343  
   344  // Unique identifier of the framework the assessment will be created from.
   345  func (o AssessmentOutput) FrameworkId() pulumi.StringOutput {
   346  	return o.ApplyT(func(v *Assessment) pulumi.StringOutput { return v.FrameworkId }).(pulumi.StringOutput)
   347  }
   348  
   349  // Name of the assessment.
   350  func (o AssessmentOutput) Name() pulumi.StringOutput {
   351  	return o.ApplyT(func(v *Assessment) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   352  }
   353  
   354  // List of roles for the assessment. See `roles` below.
   355  func (o AssessmentOutput) Roles() AssessmentRoleArrayOutput {
   356  	return o.ApplyT(func(v *Assessment) AssessmentRoleArrayOutput { return v.Roles }).(AssessmentRoleArrayOutput)
   357  }
   358  
   359  // Complete list of all roles with access to the assessment. This includes both roles explicitly configured via the `roles` block, and any roles which have access to all Audit Manager assessments by default.
   360  func (o AssessmentOutput) RolesAlls() AssessmentRolesAllArrayOutput {
   361  	return o.ApplyT(func(v *Assessment) AssessmentRolesAllArrayOutput { return v.RolesAlls }).(AssessmentRolesAllArrayOutput)
   362  }
   363  
   364  // Amazon Web Services accounts and services that are in scope for the assessment. See `scope` below.
   365  //
   366  // The following arguments are optional:
   367  func (o AssessmentOutput) Scope() AssessmentScopePtrOutput {
   368  	return o.ApplyT(func(v *Assessment) AssessmentScopePtrOutput { return v.Scope }).(AssessmentScopePtrOutput)
   369  }
   370  
   371  // Status of the assessment. Valid values are `ACTIVE` and `INACTIVE`.
   372  func (o AssessmentOutput) Status() pulumi.StringOutput {
   373  	return o.ApplyT(func(v *Assessment) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
   374  }
   375  
   376  // A map of tags to assign to the assessment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   377  func (o AssessmentOutput) Tags() pulumi.StringMapOutput {
   378  	return o.ApplyT(func(v *Assessment) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   379  }
   380  
   381  // Deprecated: Please use `tags` instead.
   382  func (o AssessmentOutput) TagsAll() pulumi.StringMapOutput {
   383  	return o.ApplyT(func(v *Assessment) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   384  }
   385  
   386  type AssessmentArrayOutput struct{ *pulumi.OutputState }
   387  
   388  func (AssessmentArrayOutput) ElementType() reflect.Type {
   389  	return reflect.TypeOf((*[]*Assessment)(nil)).Elem()
   390  }
   391  
   392  func (o AssessmentArrayOutput) ToAssessmentArrayOutput() AssessmentArrayOutput {
   393  	return o
   394  }
   395  
   396  func (o AssessmentArrayOutput) ToAssessmentArrayOutputWithContext(ctx context.Context) AssessmentArrayOutput {
   397  	return o
   398  }
   399  
   400  func (o AssessmentArrayOutput) Index(i pulumi.IntInput) AssessmentOutput {
   401  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Assessment {
   402  		return vs[0].([]*Assessment)[vs[1].(int)]
   403  	}).(AssessmentOutput)
   404  }
   405  
   406  type AssessmentMapOutput struct{ *pulumi.OutputState }
   407  
   408  func (AssessmentMapOutput) ElementType() reflect.Type {
   409  	return reflect.TypeOf((*map[string]*Assessment)(nil)).Elem()
   410  }
   411  
   412  func (o AssessmentMapOutput) ToAssessmentMapOutput() AssessmentMapOutput {
   413  	return o
   414  }
   415  
   416  func (o AssessmentMapOutput) ToAssessmentMapOutputWithContext(ctx context.Context) AssessmentMapOutput {
   417  	return o
   418  }
   419  
   420  func (o AssessmentMapOutput) MapIndex(k pulumi.StringInput) AssessmentOutput {
   421  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Assessment {
   422  		return vs[0].(map[string]*Assessment)[vs[1].(string)]
   423  	}).(AssessmentOutput)
   424  }
   425  
   426  func init() {
   427  	pulumi.RegisterInputType(reflect.TypeOf((*AssessmentInput)(nil)).Elem(), &Assessment{})
   428  	pulumi.RegisterInputType(reflect.TypeOf((*AssessmentArrayInput)(nil)).Elem(), AssessmentArray{})
   429  	pulumi.RegisterInputType(reflect.TypeOf((*AssessmentMapInput)(nil)).Elem(), AssessmentMap{})
   430  	pulumi.RegisterOutputType(AssessmentOutput{})
   431  	pulumi.RegisterOutputType(AssessmentArrayOutput{})
   432  	pulumi.RegisterOutputType(AssessmentMapOutput{})
   433  }