github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/apigateway/documentationVersion.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 apigateway 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 an API Gateway Documentation Version. 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/apigateway" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // exampleRestApi, err := apigateway.NewRestApi(ctx, "example", &apigateway.RestApiArgs{ 33 // Name: pulumi.String("example_api"), 34 // }) 35 // if err != nil { 36 // return err 37 // } 38 // exampleDocumentationPart, err := apigateway.NewDocumentationPart(ctx, "example", &apigateway.DocumentationPartArgs{ 39 // Location: &apigateway.DocumentationPartLocationArgs{ 40 // Type: pulumi.String("API"), 41 // }, 42 // Properties: pulumi.String("{\"description\":\"Example\"}"), 43 // RestApiId: exampleRestApi.ID(), 44 // }) 45 // if err != nil { 46 // return err 47 // } 48 // _, err = apigateway.NewDocumentationVersion(ctx, "example", &apigateway.DocumentationVersionArgs{ 49 // Version: pulumi.String("example_version"), 50 // RestApiId: exampleRestApi.ID(), 51 // Description: pulumi.String("Example description"), 52 // }, pulumi.DependsOn([]pulumi.Resource{ 53 // exampleDocumentationPart, 54 // })) 55 // if err != nil { 56 // return err 57 // } 58 // return nil 59 // }) 60 // } 61 // 62 // ``` 63 // <!--End PulumiCodeChooser --> 64 // 65 // ## Import 66 // 67 // Using `pulumi import`, import API Gateway documentation versions using `REST-API-ID/VERSION`. For example: 68 // 69 // ```sh 70 // $ pulumi import aws:apigateway/documentationVersion:DocumentationVersion example 5i4e1ko720/example-version 71 // ``` 72 type DocumentationVersion struct { 73 pulumi.CustomResourceState 74 75 // Description of the API documentation version. 76 Description pulumi.StringPtrOutput `pulumi:"description"` 77 // ID of the associated Rest API 78 RestApiId pulumi.StringOutput `pulumi:"restApiId"` 79 // Version identifier of the API documentation snapshot. 80 Version pulumi.StringOutput `pulumi:"version"` 81 } 82 83 // NewDocumentationVersion registers a new resource with the given unique name, arguments, and options. 84 func NewDocumentationVersion(ctx *pulumi.Context, 85 name string, args *DocumentationVersionArgs, opts ...pulumi.ResourceOption) (*DocumentationVersion, error) { 86 if args == nil { 87 return nil, errors.New("missing one or more required arguments") 88 } 89 90 if args.RestApiId == nil { 91 return nil, errors.New("invalid value for required argument 'RestApiId'") 92 } 93 if args.Version == nil { 94 return nil, errors.New("invalid value for required argument 'Version'") 95 } 96 opts = internal.PkgResourceDefaultOpts(opts) 97 var resource DocumentationVersion 98 err := ctx.RegisterResource("aws:apigateway/documentationVersion:DocumentationVersion", name, args, &resource, opts...) 99 if err != nil { 100 return nil, err 101 } 102 return &resource, nil 103 } 104 105 // GetDocumentationVersion gets an existing DocumentationVersion resource's state with the given name, ID, and optional 106 // state properties that are used to uniquely qualify the lookup (nil if not required). 107 func GetDocumentationVersion(ctx *pulumi.Context, 108 name string, id pulumi.IDInput, state *DocumentationVersionState, opts ...pulumi.ResourceOption) (*DocumentationVersion, error) { 109 var resource DocumentationVersion 110 err := ctx.ReadResource("aws:apigateway/documentationVersion:DocumentationVersion", name, id, state, &resource, opts...) 111 if err != nil { 112 return nil, err 113 } 114 return &resource, nil 115 } 116 117 // Input properties used for looking up and filtering DocumentationVersion resources. 118 type documentationVersionState struct { 119 // Description of the API documentation version. 120 Description *string `pulumi:"description"` 121 // ID of the associated Rest API 122 RestApiId *string `pulumi:"restApiId"` 123 // Version identifier of the API documentation snapshot. 124 Version *string `pulumi:"version"` 125 } 126 127 type DocumentationVersionState struct { 128 // Description of the API documentation version. 129 Description pulumi.StringPtrInput 130 // ID of the associated Rest API 131 RestApiId pulumi.StringPtrInput 132 // Version identifier of the API documentation snapshot. 133 Version pulumi.StringPtrInput 134 } 135 136 func (DocumentationVersionState) ElementType() reflect.Type { 137 return reflect.TypeOf((*documentationVersionState)(nil)).Elem() 138 } 139 140 type documentationVersionArgs struct { 141 // Description of the API documentation version. 142 Description *string `pulumi:"description"` 143 // ID of the associated Rest API 144 RestApiId string `pulumi:"restApiId"` 145 // Version identifier of the API documentation snapshot. 146 Version string `pulumi:"version"` 147 } 148 149 // The set of arguments for constructing a DocumentationVersion resource. 150 type DocumentationVersionArgs struct { 151 // Description of the API documentation version. 152 Description pulumi.StringPtrInput 153 // ID of the associated Rest API 154 RestApiId pulumi.StringInput 155 // Version identifier of the API documentation snapshot. 156 Version pulumi.StringInput 157 } 158 159 func (DocumentationVersionArgs) ElementType() reflect.Type { 160 return reflect.TypeOf((*documentationVersionArgs)(nil)).Elem() 161 } 162 163 type DocumentationVersionInput interface { 164 pulumi.Input 165 166 ToDocumentationVersionOutput() DocumentationVersionOutput 167 ToDocumentationVersionOutputWithContext(ctx context.Context) DocumentationVersionOutput 168 } 169 170 func (*DocumentationVersion) ElementType() reflect.Type { 171 return reflect.TypeOf((**DocumentationVersion)(nil)).Elem() 172 } 173 174 func (i *DocumentationVersion) ToDocumentationVersionOutput() DocumentationVersionOutput { 175 return i.ToDocumentationVersionOutputWithContext(context.Background()) 176 } 177 178 func (i *DocumentationVersion) ToDocumentationVersionOutputWithContext(ctx context.Context) DocumentationVersionOutput { 179 return pulumi.ToOutputWithContext(ctx, i).(DocumentationVersionOutput) 180 } 181 182 // DocumentationVersionArrayInput is an input type that accepts DocumentationVersionArray and DocumentationVersionArrayOutput values. 183 // You can construct a concrete instance of `DocumentationVersionArrayInput` via: 184 // 185 // DocumentationVersionArray{ DocumentationVersionArgs{...} } 186 type DocumentationVersionArrayInput interface { 187 pulumi.Input 188 189 ToDocumentationVersionArrayOutput() DocumentationVersionArrayOutput 190 ToDocumentationVersionArrayOutputWithContext(context.Context) DocumentationVersionArrayOutput 191 } 192 193 type DocumentationVersionArray []DocumentationVersionInput 194 195 func (DocumentationVersionArray) ElementType() reflect.Type { 196 return reflect.TypeOf((*[]*DocumentationVersion)(nil)).Elem() 197 } 198 199 func (i DocumentationVersionArray) ToDocumentationVersionArrayOutput() DocumentationVersionArrayOutput { 200 return i.ToDocumentationVersionArrayOutputWithContext(context.Background()) 201 } 202 203 func (i DocumentationVersionArray) ToDocumentationVersionArrayOutputWithContext(ctx context.Context) DocumentationVersionArrayOutput { 204 return pulumi.ToOutputWithContext(ctx, i).(DocumentationVersionArrayOutput) 205 } 206 207 // DocumentationVersionMapInput is an input type that accepts DocumentationVersionMap and DocumentationVersionMapOutput values. 208 // You can construct a concrete instance of `DocumentationVersionMapInput` via: 209 // 210 // DocumentationVersionMap{ "key": DocumentationVersionArgs{...} } 211 type DocumentationVersionMapInput interface { 212 pulumi.Input 213 214 ToDocumentationVersionMapOutput() DocumentationVersionMapOutput 215 ToDocumentationVersionMapOutputWithContext(context.Context) DocumentationVersionMapOutput 216 } 217 218 type DocumentationVersionMap map[string]DocumentationVersionInput 219 220 func (DocumentationVersionMap) ElementType() reflect.Type { 221 return reflect.TypeOf((*map[string]*DocumentationVersion)(nil)).Elem() 222 } 223 224 func (i DocumentationVersionMap) ToDocumentationVersionMapOutput() DocumentationVersionMapOutput { 225 return i.ToDocumentationVersionMapOutputWithContext(context.Background()) 226 } 227 228 func (i DocumentationVersionMap) ToDocumentationVersionMapOutputWithContext(ctx context.Context) DocumentationVersionMapOutput { 229 return pulumi.ToOutputWithContext(ctx, i).(DocumentationVersionMapOutput) 230 } 231 232 type DocumentationVersionOutput struct{ *pulumi.OutputState } 233 234 func (DocumentationVersionOutput) ElementType() reflect.Type { 235 return reflect.TypeOf((**DocumentationVersion)(nil)).Elem() 236 } 237 238 func (o DocumentationVersionOutput) ToDocumentationVersionOutput() DocumentationVersionOutput { 239 return o 240 } 241 242 func (o DocumentationVersionOutput) ToDocumentationVersionOutputWithContext(ctx context.Context) DocumentationVersionOutput { 243 return o 244 } 245 246 // Description of the API documentation version. 247 func (o DocumentationVersionOutput) Description() pulumi.StringPtrOutput { 248 return o.ApplyT(func(v *DocumentationVersion) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput) 249 } 250 251 // ID of the associated Rest API 252 func (o DocumentationVersionOutput) RestApiId() pulumi.StringOutput { 253 return o.ApplyT(func(v *DocumentationVersion) pulumi.StringOutput { return v.RestApiId }).(pulumi.StringOutput) 254 } 255 256 // Version identifier of the API documentation snapshot. 257 func (o DocumentationVersionOutput) Version() pulumi.StringOutput { 258 return o.ApplyT(func(v *DocumentationVersion) pulumi.StringOutput { return v.Version }).(pulumi.StringOutput) 259 } 260 261 type DocumentationVersionArrayOutput struct{ *pulumi.OutputState } 262 263 func (DocumentationVersionArrayOutput) ElementType() reflect.Type { 264 return reflect.TypeOf((*[]*DocumentationVersion)(nil)).Elem() 265 } 266 267 func (o DocumentationVersionArrayOutput) ToDocumentationVersionArrayOutput() DocumentationVersionArrayOutput { 268 return o 269 } 270 271 func (o DocumentationVersionArrayOutput) ToDocumentationVersionArrayOutputWithContext(ctx context.Context) DocumentationVersionArrayOutput { 272 return o 273 } 274 275 func (o DocumentationVersionArrayOutput) Index(i pulumi.IntInput) DocumentationVersionOutput { 276 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *DocumentationVersion { 277 return vs[0].([]*DocumentationVersion)[vs[1].(int)] 278 }).(DocumentationVersionOutput) 279 } 280 281 type DocumentationVersionMapOutput struct{ *pulumi.OutputState } 282 283 func (DocumentationVersionMapOutput) ElementType() reflect.Type { 284 return reflect.TypeOf((*map[string]*DocumentationVersion)(nil)).Elem() 285 } 286 287 func (o DocumentationVersionMapOutput) ToDocumentationVersionMapOutput() DocumentationVersionMapOutput { 288 return o 289 } 290 291 func (o DocumentationVersionMapOutput) ToDocumentationVersionMapOutputWithContext(ctx context.Context) DocumentationVersionMapOutput { 292 return o 293 } 294 295 func (o DocumentationVersionMapOutput) MapIndex(k pulumi.StringInput) DocumentationVersionOutput { 296 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *DocumentationVersion { 297 return vs[0].(map[string]*DocumentationVersion)[vs[1].(string)] 298 }).(DocumentationVersionOutput) 299 } 300 301 func init() { 302 pulumi.RegisterInputType(reflect.TypeOf((*DocumentationVersionInput)(nil)).Elem(), &DocumentationVersion{}) 303 pulumi.RegisterInputType(reflect.TypeOf((*DocumentationVersionArrayInput)(nil)).Elem(), DocumentationVersionArray{}) 304 pulumi.RegisterInputType(reflect.TypeOf((*DocumentationVersionMapInput)(nil)).Elem(), DocumentationVersionMap{}) 305 pulumi.RegisterOutputType(DocumentationVersionOutput{}) 306 pulumi.RegisterOutputType(DocumentationVersionArrayOutput{}) 307 pulumi.RegisterOutputType(DocumentationVersionMapOutput{}) 308 }