-
Notifications
You must be signed in to change notification settings - Fork 151
/
getDocument.go
173 lines (152 loc) · 5.52 KB
/
getDocument.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package ssm
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Gets the contents of the specified Systems Manager document.
//
// ## Example Usage
//
// To get the contents of the document owned by AWS.
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ssm"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// opt0 := "YAML"
// foo, err := ssm.LookupDocument(ctx, &ssm.LookupDocumentArgs{
// Name: "AWS-GatherSoftwareInventory",
// DocumentFormat: &opt0,
// }, nil)
// if err != nil {
// return err
// }
// ctx.Export("content", foo.Content)
// return nil
// })
// }
// ```
//
// To get the contents of the custom document.
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ssm"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// opt0 := "JSON"
// _, err := ssm.LookupDocument(ctx, &ssm.LookupDocumentArgs{
// Name: aws_ssm_document.Test.Name,
// DocumentFormat: &opt0,
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
func LookupDocument(ctx *pulumi.Context, args *LookupDocumentArgs, opts ...pulumi.InvokeOption) (*LookupDocumentResult, error) {
var rv LookupDocumentResult
err := ctx.Invoke("aws:ssm/getDocument:getDocument", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getDocument.
type LookupDocumentArgs struct {
// Returns the document in the specified format. The document format can be either JSON or YAML. JSON is the default format.
DocumentFormat *string `pulumi:"documentFormat"`
// The document version for which you want information.
DocumentVersion *string `pulumi:"documentVersion"`
// The name of the Systems Manager document.
Name string `pulumi:"name"`
}
// A collection of values returned by getDocument.
type LookupDocumentResult struct {
// The ARN of the document.
Arn string `pulumi:"arn"`
// The contents of the document.
Content string `pulumi:"content"`
DocumentFormat *string `pulumi:"documentFormat"`
// The type of the document.
DocumentType string `pulumi:"documentType"`
DocumentVersion *string `pulumi:"documentVersion"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
Name string `pulumi:"name"`
}
func LookupDocumentOutput(ctx *pulumi.Context, args LookupDocumentOutputArgs, opts ...pulumi.InvokeOption) LookupDocumentResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupDocumentResult, error) {
args := v.(LookupDocumentArgs)
r, err := LookupDocument(ctx, &args, opts...)
return *r, err
}).(LookupDocumentResultOutput)
}
// A collection of arguments for invoking getDocument.
type LookupDocumentOutputArgs struct {
// Returns the document in the specified format. The document format can be either JSON or YAML. JSON is the default format.
DocumentFormat pulumi.StringPtrInput `pulumi:"documentFormat"`
// The document version for which you want information.
DocumentVersion pulumi.StringPtrInput `pulumi:"documentVersion"`
// The name of the Systems Manager document.
Name pulumi.StringInput `pulumi:"name"`
}
func (LookupDocumentOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupDocumentArgs)(nil)).Elem()
}
// A collection of values returned by getDocument.
type LookupDocumentResultOutput struct{ *pulumi.OutputState }
func (LookupDocumentResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupDocumentResult)(nil)).Elem()
}
func (o LookupDocumentResultOutput) ToLookupDocumentResultOutput() LookupDocumentResultOutput {
return o
}
func (o LookupDocumentResultOutput) ToLookupDocumentResultOutputWithContext(ctx context.Context) LookupDocumentResultOutput {
return o
}
// The ARN of the document.
func (o LookupDocumentResultOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v LookupDocumentResult) string { return v.Arn }).(pulumi.StringOutput)
}
// The contents of the document.
func (o LookupDocumentResultOutput) Content() pulumi.StringOutput {
return o.ApplyT(func(v LookupDocumentResult) string { return v.Content }).(pulumi.StringOutput)
}
func (o LookupDocumentResultOutput) DocumentFormat() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupDocumentResult) *string { return v.DocumentFormat }).(pulumi.StringPtrOutput)
}
// The type of the document.
func (o LookupDocumentResultOutput) DocumentType() pulumi.StringOutput {
return o.ApplyT(func(v LookupDocumentResult) string { return v.DocumentType }).(pulumi.StringOutput)
}
func (o LookupDocumentResultOutput) DocumentVersion() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupDocumentResult) *string { return v.DocumentVersion }).(pulumi.StringPtrOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o LookupDocumentResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupDocumentResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o LookupDocumentResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupDocumentResult) string { return v.Name }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(LookupDocumentResultOutput{})
}