github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ssm/getDocument.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 ssm 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 // Gets the contents of the specified Systems Manager document. 15 // 16 // ## Example Usage 17 // 18 // To get the contents of the document owned by AWS. 19 // 20 // <!--Start PulumiCodeChooser --> 21 // ```go 22 // package main 23 // 24 // import ( 25 // 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm" 27 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // foo, err := ssm.LookupDocument(ctx, &ssm.LookupDocumentArgs{ 34 // Name: "AWS-GatherSoftwareInventory", 35 // DocumentFormat: pulumi.StringRef("YAML"), 36 // }, nil) 37 // if err != nil { 38 // return err 39 // } 40 // ctx.Export("content", foo.Content) 41 // return nil 42 // }) 43 // } 44 // 45 // ``` 46 // <!--End PulumiCodeChooser --> 47 // 48 // To get the contents of the custom document. 49 // 50 // <!--Start PulumiCodeChooser --> 51 // ```go 52 // package main 53 // 54 // import ( 55 // 56 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm" 57 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 58 // 59 // ) 60 // 61 // func main() { 62 // pulumi.Run(func(ctx *pulumi.Context) error { 63 // _, err := ssm.LookupDocument(ctx, &ssm.LookupDocumentArgs{ 64 // Name: testAwsSsmDocument.Name, 65 // DocumentFormat: pulumi.StringRef("JSON"), 66 // }, nil) 67 // if err != nil { 68 // return err 69 // } 70 // return nil 71 // }) 72 // } 73 // 74 // ``` 75 // <!--End PulumiCodeChooser --> 76 func LookupDocument(ctx *pulumi.Context, args *LookupDocumentArgs, opts ...pulumi.InvokeOption) (*LookupDocumentResult, error) { 77 opts = internal.PkgInvokeDefaultOpts(opts) 78 var rv LookupDocumentResult 79 err := ctx.Invoke("aws:ssm/getDocument:getDocument", args, &rv, opts...) 80 if err != nil { 81 return nil, err 82 } 83 return &rv, nil 84 } 85 86 // A collection of arguments for invoking getDocument. 87 type LookupDocumentArgs struct { 88 // The format of the document. Valid values: `JSON`, `TEXT`, `YAML`. 89 DocumentFormat *string `pulumi:"documentFormat"` 90 // The document version. 91 DocumentVersion *string `pulumi:"documentVersion"` 92 // The name of the document. 93 Name string `pulumi:"name"` 94 } 95 96 // A collection of values returned by getDocument. 97 type LookupDocumentResult struct { 98 // ARN of the document. If the document is an AWS managed document, this value will be set to the name of the document instead. 99 Arn string `pulumi:"arn"` 100 // The content for the SSM document in JSON or YAML format. 101 Content string `pulumi:"content"` 102 DocumentFormat *string `pulumi:"documentFormat"` 103 // The type of the document. 104 DocumentType string `pulumi:"documentType"` 105 DocumentVersion *string `pulumi:"documentVersion"` 106 // The provider-assigned unique ID for this managed resource. 107 Id string `pulumi:"id"` 108 Name string `pulumi:"name"` 109 } 110 111 func LookupDocumentOutput(ctx *pulumi.Context, args LookupDocumentOutputArgs, opts ...pulumi.InvokeOption) LookupDocumentResultOutput { 112 return pulumi.ToOutputWithContext(context.Background(), args). 113 ApplyT(func(v interface{}) (LookupDocumentResult, error) { 114 args := v.(LookupDocumentArgs) 115 r, err := LookupDocument(ctx, &args, opts...) 116 var s LookupDocumentResult 117 if r != nil { 118 s = *r 119 } 120 return s, err 121 }).(LookupDocumentResultOutput) 122 } 123 124 // A collection of arguments for invoking getDocument. 125 type LookupDocumentOutputArgs struct { 126 // The format of the document. Valid values: `JSON`, `TEXT`, `YAML`. 127 DocumentFormat pulumi.StringPtrInput `pulumi:"documentFormat"` 128 // The document version. 129 DocumentVersion pulumi.StringPtrInput `pulumi:"documentVersion"` 130 // The name of the document. 131 Name pulumi.StringInput `pulumi:"name"` 132 } 133 134 func (LookupDocumentOutputArgs) ElementType() reflect.Type { 135 return reflect.TypeOf((*LookupDocumentArgs)(nil)).Elem() 136 } 137 138 // A collection of values returned by getDocument. 139 type LookupDocumentResultOutput struct{ *pulumi.OutputState } 140 141 func (LookupDocumentResultOutput) ElementType() reflect.Type { 142 return reflect.TypeOf((*LookupDocumentResult)(nil)).Elem() 143 } 144 145 func (o LookupDocumentResultOutput) ToLookupDocumentResultOutput() LookupDocumentResultOutput { 146 return o 147 } 148 149 func (o LookupDocumentResultOutput) ToLookupDocumentResultOutputWithContext(ctx context.Context) LookupDocumentResultOutput { 150 return o 151 } 152 153 // ARN of the document. If the document is an AWS managed document, this value will be set to the name of the document instead. 154 func (o LookupDocumentResultOutput) Arn() pulumi.StringOutput { 155 return o.ApplyT(func(v LookupDocumentResult) string { return v.Arn }).(pulumi.StringOutput) 156 } 157 158 // The content for the SSM document in JSON or YAML format. 159 func (o LookupDocumentResultOutput) Content() pulumi.StringOutput { 160 return o.ApplyT(func(v LookupDocumentResult) string { return v.Content }).(pulumi.StringOutput) 161 } 162 163 func (o LookupDocumentResultOutput) DocumentFormat() pulumi.StringPtrOutput { 164 return o.ApplyT(func(v LookupDocumentResult) *string { return v.DocumentFormat }).(pulumi.StringPtrOutput) 165 } 166 167 // The type of the document. 168 func (o LookupDocumentResultOutput) DocumentType() pulumi.StringOutput { 169 return o.ApplyT(func(v LookupDocumentResult) string { return v.DocumentType }).(pulumi.StringOutput) 170 } 171 172 func (o LookupDocumentResultOutput) DocumentVersion() pulumi.StringPtrOutput { 173 return o.ApplyT(func(v LookupDocumentResult) *string { return v.DocumentVersion }).(pulumi.StringPtrOutput) 174 } 175 176 // The provider-assigned unique ID for this managed resource. 177 func (o LookupDocumentResultOutput) Id() pulumi.StringOutput { 178 return o.ApplyT(func(v LookupDocumentResult) string { return v.Id }).(pulumi.StringOutput) 179 } 180 181 func (o LookupDocumentResultOutput) Name() pulumi.StringOutput { 182 return o.ApplyT(func(v LookupDocumentResult) string { return v.Name }).(pulumi.StringOutput) 183 } 184 185 func init() { 186 pulumi.RegisterOutputType(LookupDocumentResultOutput{}) 187 }