github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/apigateway/documentationPart.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 settings of an API Gateway Documentation Part.
    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  //			_, err = apigateway.NewDocumentationPart(ctx, "example", &apigateway.DocumentationPartArgs{
    39  //				Location: &apigateway.DocumentationPartLocationArgs{
    40  //					Type:   pulumi.String("METHOD"),
    41  //					Method: pulumi.String("GET"),
    42  //					Path:   pulumi.String("/example"),
    43  //				},
    44  //				Properties: pulumi.String("{\"description\":\"Example description\"}"),
    45  //				RestApiId:  exampleRestApi.ID(),
    46  //			})
    47  //			if err != nil {
    48  //				return err
    49  //			}
    50  //			return nil
    51  //		})
    52  //	}
    53  //
    54  // ```
    55  // <!--End PulumiCodeChooser -->
    56  //
    57  // ## Import
    58  //
    59  // Using `pulumi import`, import API Gateway documentation_parts using `REST-API-ID/DOC-PART-ID`. For example:
    60  //
    61  // ```sh
    62  // $ pulumi import aws:apigateway/documentationPart:DocumentationPart example 5i4e1ko720/3oyy3t
    63  // ```
    64  type DocumentationPart struct {
    65  	pulumi.CustomResourceState
    66  
    67  	// The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
    68  	DocumentationPartId pulumi.StringOutput `pulumi:"documentationPartId"`
    69  	// Location of the targeted API entity of the to-be-created documentation part. See below.
    70  	Location DocumentationPartLocationOutput `pulumi:"location"`
    71  	// Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ \"description\": \"The API does ...\" }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
    72  	Properties pulumi.StringOutput `pulumi:"properties"`
    73  	// ID of the associated Rest API
    74  	RestApiId pulumi.StringOutput `pulumi:"restApiId"`
    75  }
    76  
    77  // NewDocumentationPart registers a new resource with the given unique name, arguments, and options.
    78  func NewDocumentationPart(ctx *pulumi.Context,
    79  	name string, args *DocumentationPartArgs, opts ...pulumi.ResourceOption) (*DocumentationPart, error) {
    80  	if args == nil {
    81  		return nil, errors.New("missing one or more required arguments")
    82  	}
    83  
    84  	if args.Location == nil {
    85  		return nil, errors.New("invalid value for required argument 'Location'")
    86  	}
    87  	if args.Properties == nil {
    88  		return nil, errors.New("invalid value for required argument 'Properties'")
    89  	}
    90  	if args.RestApiId == nil {
    91  		return nil, errors.New("invalid value for required argument 'RestApiId'")
    92  	}
    93  	opts = internal.PkgResourceDefaultOpts(opts)
    94  	var resource DocumentationPart
    95  	err := ctx.RegisterResource("aws:apigateway/documentationPart:DocumentationPart", name, args, &resource, opts...)
    96  	if err != nil {
    97  		return nil, err
    98  	}
    99  	return &resource, nil
   100  }
   101  
   102  // GetDocumentationPart gets an existing DocumentationPart resource's state with the given name, ID, and optional
   103  // state properties that are used to uniquely qualify the lookup (nil if not required).
   104  func GetDocumentationPart(ctx *pulumi.Context,
   105  	name string, id pulumi.IDInput, state *DocumentationPartState, opts ...pulumi.ResourceOption) (*DocumentationPart, error) {
   106  	var resource DocumentationPart
   107  	err := ctx.ReadResource("aws:apigateway/documentationPart:DocumentationPart", name, id, state, &resource, opts...)
   108  	if err != nil {
   109  		return nil, err
   110  	}
   111  	return &resource, nil
   112  }
   113  
   114  // Input properties used for looking up and filtering DocumentationPart resources.
   115  type documentationPartState struct {
   116  	// The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
   117  	DocumentationPartId *string `pulumi:"documentationPartId"`
   118  	// Location of the targeted API entity of the to-be-created documentation part. See below.
   119  	Location *DocumentationPartLocation `pulumi:"location"`
   120  	// Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ \"description\": \"The API does ...\" }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
   121  	Properties *string `pulumi:"properties"`
   122  	// ID of the associated Rest API
   123  	RestApiId *string `pulumi:"restApiId"`
   124  }
   125  
   126  type DocumentationPartState struct {
   127  	// The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
   128  	DocumentationPartId pulumi.StringPtrInput
   129  	// Location of the targeted API entity of the to-be-created documentation part. See below.
   130  	Location DocumentationPartLocationPtrInput
   131  	// Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ \"description\": \"The API does ...\" }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
   132  	Properties pulumi.StringPtrInput
   133  	// ID of the associated Rest API
   134  	RestApiId pulumi.StringPtrInput
   135  }
   136  
   137  func (DocumentationPartState) ElementType() reflect.Type {
   138  	return reflect.TypeOf((*documentationPartState)(nil)).Elem()
   139  }
   140  
   141  type documentationPartArgs struct {
   142  	// Location of the targeted API entity of the to-be-created documentation part. See below.
   143  	Location DocumentationPartLocation `pulumi:"location"`
   144  	// Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ \"description\": \"The API does ...\" }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
   145  	Properties string `pulumi:"properties"`
   146  	// ID of the associated Rest API
   147  	RestApiId string `pulumi:"restApiId"`
   148  }
   149  
   150  // The set of arguments for constructing a DocumentationPart resource.
   151  type DocumentationPartArgs struct {
   152  	// Location of the targeted API entity of the to-be-created documentation part. See below.
   153  	Location DocumentationPartLocationInput
   154  	// Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ \"description\": \"The API does ...\" }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
   155  	Properties pulumi.StringInput
   156  	// ID of the associated Rest API
   157  	RestApiId pulumi.StringInput
   158  }
   159  
   160  func (DocumentationPartArgs) ElementType() reflect.Type {
   161  	return reflect.TypeOf((*documentationPartArgs)(nil)).Elem()
   162  }
   163  
   164  type DocumentationPartInput interface {
   165  	pulumi.Input
   166  
   167  	ToDocumentationPartOutput() DocumentationPartOutput
   168  	ToDocumentationPartOutputWithContext(ctx context.Context) DocumentationPartOutput
   169  }
   170  
   171  func (*DocumentationPart) ElementType() reflect.Type {
   172  	return reflect.TypeOf((**DocumentationPart)(nil)).Elem()
   173  }
   174  
   175  func (i *DocumentationPart) ToDocumentationPartOutput() DocumentationPartOutput {
   176  	return i.ToDocumentationPartOutputWithContext(context.Background())
   177  }
   178  
   179  func (i *DocumentationPart) ToDocumentationPartOutputWithContext(ctx context.Context) DocumentationPartOutput {
   180  	return pulumi.ToOutputWithContext(ctx, i).(DocumentationPartOutput)
   181  }
   182  
   183  // DocumentationPartArrayInput is an input type that accepts DocumentationPartArray and DocumentationPartArrayOutput values.
   184  // You can construct a concrete instance of `DocumentationPartArrayInput` via:
   185  //
   186  //	DocumentationPartArray{ DocumentationPartArgs{...} }
   187  type DocumentationPartArrayInput interface {
   188  	pulumi.Input
   189  
   190  	ToDocumentationPartArrayOutput() DocumentationPartArrayOutput
   191  	ToDocumentationPartArrayOutputWithContext(context.Context) DocumentationPartArrayOutput
   192  }
   193  
   194  type DocumentationPartArray []DocumentationPartInput
   195  
   196  func (DocumentationPartArray) ElementType() reflect.Type {
   197  	return reflect.TypeOf((*[]*DocumentationPart)(nil)).Elem()
   198  }
   199  
   200  func (i DocumentationPartArray) ToDocumentationPartArrayOutput() DocumentationPartArrayOutput {
   201  	return i.ToDocumentationPartArrayOutputWithContext(context.Background())
   202  }
   203  
   204  func (i DocumentationPartArray) ToDocumentationPartArrayOutputWithContext(ctx context.Context) DocumentationPartArrayOutput {
   205  	return pulumi.ToOutputWithContext(ctx, i).(DocumentationPartArrayOutput)
   206  }
   207  
   208  // DocumentationPartMapInput is an input type that accepts DocumentationPartMap and DocumentationPartMapOutput values.
   209  // You can construct a concrete instance of `DocumentationPartMapInput` via:
   210  //
   211  //	DocumentationPartMap{ "key": DocumentationPartArgs{...} }
   212  type DocumentationPartMapInput interface {
   213  	pulumi.Input
   214  
   215  	ToDocumentationPartMapOutput() DocumentationPartMapOutput
   216  	ToDocumentationPartMapOutputWithContext(context.Context) DocumentationPartMapOutput
   217  }
   218  
   219  type DocumentationPartMap map[string]DocumentationPartInput
   220  
   221  func (DocumentationPartMap) ElementType() reflect.Type {
   222  	return reflect.TypeOf((*map[string]*DocumentationPart)(nil)).Elem()
   223  }
   224  
   225  func (i DocumentationPartMap) ToDocumentationPartMapOutput() DocumentationPartMapOutput {
   226  	return i.ToDocumentationPartMapOutputWithContext(context.Background())
   227  }
   228  
   229  func (i DocumentationPartMap) ToDocumentationPartMapOutputWithContext(ctx context.Context) DocumentationPartMapOutput {
   230  	return pulumi.ToOutputWithContext(ctx, i).(DocumentationPartMapOutput)
   231  }
   232  
   233  type DocumentationPartOutput struct{ *pulumi.OutputState }
   234  
   235  func (DocumentationPartOutput) ElementType() reflect.Type {
   236  	return reflect.TypeOf((**DocumentationPart)(nil)).Elem()
   237  }
   238  
   239  func (o DocumentationPartOutput) ToDocumentationPartOutput() DocumentationPartOutput {
   240  	return o
   241  }
   242  
   243  func (o DocumentationPartOutput) ToDocumentationPartOutputWithContext(ctx context.Context) DocumentationPartOutput {
   244  	return o
   245  }
   246  
   247  // The DocumentationPart identifier, generated by API Gateway when the documentation part is created.
   248  func (o DocumentationPartOutput) DocumentationPartId() pulumi.StringOutput {
   249  	return o.ApplyT(func(v *DocumentationPart) pulumi.StringOutput { return v.DocumentationPartId }).(pulumi.StringOutput)
   250  }
   251  
   252  // Location of the targeted API entity of the to-be-created documentation part. See below.
   253  func (o DocumentationPartOutput) Location() DocumentationPartLocationOutput {
   254  	return o.ApplyT(func(v *DocumentationPart) DocumentationPartLocationOutput { return v.Location }).(DocumentationPartLocationOutput)
   255  }
   256  
   257  // Content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a JSON string, e.g., "{ \"description\": \"The API does ...\" }". Only Swagger-compliant key-value pairs can be exported and, hence, published.
   258  func (o DocumentationPartOutput) Properties() pulumi.StringOutput {
   259  	return o.ApplyT(func(v *DocumentationPart) pulumi.StringOutput { return v.Properties }).(pulumi.StringOutput)
   260  }
   261  
   262  // ID of the associated Rest API
   263  func (o DocumentationPartOutput) RestApiId() pulumi.StringOutput {
   264  	return o.ApplyT(func(v *DocumentationPart) pulumi.StringOutput { return v.RestApiId }).(pulumi.StringOutput)
   265  }
   266  
   267  type DocumentationPartArrayOutput struct{ *pulumi.OutputState }
   268  
   269  func (DocumentationPartArrayOutput) ElementType() reflect.Type {
   270  	return reflect.TypeOf((*[]*DocumentationPart)(nil)).Elem()
   271  }
   272  
   273  func (o DocumentationPartArrayOutput) ToDocumentationPartArrayOutput() DocumentationPartArrayOutput {
   274  	return o
   275  }
   276  
   277  func (o DocumentationPartArrayOutput) ToDocumentationPartArrayOutputWithContext(ctx context.Context) DocumentationPartArrayOutput {
   278  	return o
   279  }
   280  
   281  func (o DocumentationPartArrayOutput) Index(i pulumi.IntInput) DocumentationPartOutput {
   282  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *DocumentationPart {
   283  		return vs[0].([]*DocumentationPart)[vs[1].(int)]
   284  	}).(DocumentationPartOutput)
   285  }
   286  
   287  type DocumentationPartMapOutput struct{ *pulumi.OutputState }
   288  
   289  func (DocumentationPartMapOutput) ElementType() reflect.Type {
   290  	return reflect.TypeOf((*map[string]*DocumentationPart)(nil)).Elem()
   291  }
   292  
   293  func (o DocumentationPartMapOutput) ToDocumentationPartMapOutput() DocumentationPartMapOutput {
   294  	return o
   295  }
   296  
   297  func (o DocumentationPartMapOutput) ToDocumentationPartMapOutputWithContext(ctx context.Context) DocumentationPartMapOutput {
   298  	return o
   299  }
   300  
   301  func (o DocumentationPartMapOutput) MapIndex(k pulumi.StringInput) DocumentationPartOutput {
   302  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *DocumentationPart {
   303  		return vs[0].(map[string]*DocumentationPart)[vs[1].(string)]
   304  	}).(DocumentationPartOutput)
   305  }
   306  
   307  func init() {
   308  	pulumi.RegisterInputType(reflect.TypeOf((*DocumentationPartInput)(nil)).Elem(), &DocumentationPart{})
   309  	pulumi.RegisterInputType(reflect.TypeOf((*DocumentationPartArrayInput)(nil)).Elem(), DocumentationPartArray{})
   310  	pulumi.RegisterInputType(reflect.TypeOf((*DocumentationPartMapInput)(nil)).Elem(), DocumentationPartMap{})
   311  	pulumi.RegisterOutputType(DocumentationPartOutput{})
   312  	pulumi.RegisterOutputType(DocumentationPartArrayOutput{})
   313  	pulumi.RegisterOutputType(DocumentationPartMapOutput{})
   314  }