github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/resourceexplorer/search.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 resourceexplorer 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Data source for managing an AWS Resource Explorer Search. 15 // 16 // ## Example Usage 17 // 18 // ### Basic Usage 19 // 20 // <!--Start PulumiCodeChooser --> 21 // ```go 22 // package main 23 // 24 // import ( 25 // 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/resourceexplorer" 27 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // _, err := resourceexplorer.Search(ctx, &resourceexplorer.SearchArgs{ 34 // QueryString: "region:us-west-2", 35 // ViewArn: pulumi.StringRef(test.Arn), 36 // }, nil) 37 // if err != nil { 38 // return err 39 // } 40 // return nil 41 // }) 42 // } 43 // 44 // ``` 45 // <!--End PulumiCodeChooser --> 46 func Search(ctx *pulumi.Context, args *SearchArgs, opts ...pulumi.InvokeOption) (*SearchResult, error) { 47 opts = internal.PkgInvokeDefaultOpts(opts) 48 var rv SearchResult 49 err := ctx.Invoke("aws:resourceexplorer/search:Search", args, &rv, opts...) 50 if err != nil { 51 return nil, err 52 } 53 return &rv, nil 54 } 55 56 // A collection of arguments for invoking Search. 57 type SearchArgs struct { 58 // String that includes keywords and filters that specify the resources that you want to include in the results. For the complete syntax supported by the QueryString parameter, see Search query syntax reference for [Resource Explorer](https://docs.aws.amazon.com/resource-explorer/latest/userguide/using-search-query-syntax.html). The search is completely case insensitive. You can specify an empty string to return all results up to the limit of 1,000 total results. The operation can return only the first 1,000 results. If the resource you want is not included, then use a different value for QueryString to refine the results. 59 // 60 // The following arguments are optional: 61 QueryString string `pulumi:"queryString"` 62 // Number of resources that match the query. See `resourceCount` below. 63 ResourceCounts []SearchResourceCount `pulumi:"resourceCounts"` 64 // List of structures that describe the resources that match the query. See `resources` below. 65 Resources []SearchResource `pulumi:"resources"` 66 // Specifies the Amazon resource name (ARN) of the view to use for the query. If you don't specify a value for this parameter, then the operation automatically uses the default view for the AWS Region in which you called this operation. If the Region either doesn't have a default view or if you don't have permission to use the default view, then the operation fails with a `401 Unauthorized` exception. 67 ViewArn *string `pulumi:"viewArn"` 68 } 69 70 // A collection of values returned by Search. 71 type SearchResult struct { 72 // Query String. 73 Id string `pulumi:"id"` 74 QueryString string `pulumi:"queryString"` 75 // Number of resources that match the query. See `resourceCount` below. 76 ResourceCounts []SearchResourceCount `pulumi:"resourceCounts"` 77 // List of structures that describe the resources that match the query. See `resources` below. 78 Resources []SearchResource `pulumi:"resources"` 79 ViewArn *string `pulumi:"viewArn"` 80 } 81 82 func SearchOutput(ctx *pulumi.Context, args SearchOutputArgs, opts ...pulumi.InvokeOption) SearchResultOutput { 83 return pulumi.ToOutputWithContext(context.Background(), args). 84 ApplyT(func(v interface{}) (SearchResult, error) { 85 args := v.(SearchArgs) 86 r, err := Search(ctx, &args, opts...) 87 var s SearchResult 88 if r != nil { 89 s = *r 90 } 91 return s, err 92 }).(SearchResultOutput) 93 } 94 95 // A collection of arguments for invoking Search. 96 type SearchOutputArgs struct { 97 // String that includes keywords and filters that specify the resources that you want to include in the results. For the complete syntax supported by the QueryString parameter, see Search query syntax reference for [Resource Explorer](https://docs.aws.amazon.com/resource-explorer/latest/userguide/using-search-query-syntax.html). The search is completely case insensitive. You can specify an empty string to return all results up to the limit of 1,000 total results. The operation can return only the first 1,000 results. If the resource you want is not included, then use a different value for QueryString to refine the results. 98 // 99 // The following arguments are optional: 100 QueryString pulumi.StringInput `pulumi:"queryString"` 101 // Number of resources that match the query. See `resourceCount` below. 102 ResourceCounts SearchResourceCountArrayInput `pulumi:"resourceCounts"` 103 // List of structures that describe the resources that match the query. See `resources` below. 104 Resources SearchResourceArrayInput `pulumi:"resources"` 105 // Specifies the Amazon resource name (ARN) of the view to use for the query. If you don't specify a value for this parameter, then the operation automatically uses the default view for the AWS Region in which you called this operation. If the Region either doesn't have a default view or if you don't have permission to use the default view, then the operation fails with a `401 Unauthorized` exception. 106 ViewArn pulumi.StringPtrInput `pulumi:"viewArn"` 107 } 108 109 func (SearchOutputArgs) ElementType() reflect.Type { 110 return reflect.TypeOf((*SearchArgs)(nil)).Elem() 111 } 112 113 // A collection of values returned by Search. 114 type SearchResultOutput struct{ *pulumi.OutputState } 115 116 func (SearchResultOutput) ElementType() reflect.Type { 117 return reflect.TypeOf((*SearchResult)(nil)).Elem() 118 } 119 120 func (o SearchResultOutput) ToSearchResultOutput() SearchResultOutput { 121 return o 122 } 123 124 func (o SearchResultOutput) ToSearchResultOutputWithContext(ctx context.Context) SearchResultOutput { 125 return o 126 } 127 128 // Query String. 129 func (o SearchResultOutput) Id() pulumi.StringOutput { 130 return o.ApplyT(func(v SearchResult) string { return v.Id }).(pulumi.StringOutput) 131 } 132 133 func (o SearchResultOutput) QueryString() pulumi.StringOutput { 134 return o.ApplyT(func(v SearchResult) string { return v.QueryString }).(pulumi.StringOutput) 135 } 136 137 // Number of resources that match the query. See `resourceCount` below. 138 func (o SearchResultOutput) ResourceCounts() SearchResourceCountArrayOutput { 139 return o.ApplyT(func(v SearchResult) []SearchResourceCount { return v.ResourceCounts }).(SearchResourceCountArrayOutput) 140 } 141 142 // List of structures that describe the resources that match the query. See `resources` below. 143 func (o SearchResultOutput) Resources() SearchResourceArrayOutput { 144 return o.ApplyT(func(v SearchResult) []SearchResource { return v.Resources }).(SearchResourceArrayOutput) 145 } 146 147 func (o SearchResultOutput) ViewArn() pulumi.StringPtrOutput { 148 return o.ApplyT(func(v SearchResult) *string { return v.ViewArn }).(pulumi.StringPtrOutput) 149 } 150 151 func init() { 152 pulumi.RegisterOutputType(SearchResultOutput{}) 153 }