Add array-valued output properties to RestAPI

These properties no longer trigger assertons after
work on #198.
This commit is contained in:
Luke Hoban 2017-06-05 11:23:42 -07:00
parent 09f2968d18
commit 658d4b3c8a
4 changed files with 15 additions and 17 deletions

View file

@ -48,15 +48,11 @@ type RestAPI struct {
CreatedDate string `lumi:"createdDate,out"` CreatedDate string `lumi:"createdDate,out"`
// A version identifier for the API. // A version identifier for the API.
Version string `lumi:"version,out"` Version string `lumi:"version,out"`
// TODO[pulumi/lumi#198] Exposing array-valued output properties
// currently triggers failures serializing resource state, so
// supressing these properties.
// The warning messages reported when failonwarnings is turned on during API import. // The warning messages reported when failonwarnings is turned on during API import.
//Warnings []string `lumi:"warnings,out"` Warnings []string `lumi:"warnings,out"`
// The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded // The list of binary media types supported by the RestApi. By default, the RestApi supports only UTF-8-encoded
// text payloads. // text payloads.
//BinaryMediaTypes []string `lumi:"binaryMediaTypes,out"` BinaryMediaTypes []string `lumi:"binaryMediaTypes,out"`
} }
// S3Location is a property of the RestAPI resource that specifies the Amazon Simple Storage Service (Amazon S3) // S3Location is a property of the RestAPI resource that specifies the Amazon Simple Storage Service (Amazon S3)

View file

@ -17,6 +17,8 @@ export class RestAPI extends lumi.Resource implements RestAPIArgs {
public id: string; public id: string;
public createdDate: string; public createdDate: string;
public version: string; public version: string;
public warnings: string[];
public binaryMediaTypes: string[];
constructor(name: string, args?: RestAPIArgs) { constructor(name: string, args?: RestAPIArgs) {
super(); super();

View file

@ -122,17 +122,13 @@ func (p *restAPIProvider) Get(ctx context.Context, id resource.ID) (*apigateway.
} }
return &apigateway.RestAPI{ return &apigateway.RestAPI{
ID: aws.StringValue(resp.Id), ID: aws.StringValue(resp.Id),
APIName: resp.Name, APIName: resp.Name,
Description: resp.Description, Description: resp.Description,
CreatedDate: resp.CreatedDate.String(), CreatedDate: resp.CreatedDate.String(),
Version: aws.StringValue(resp.Version), Version: aws.StringValue(resp.Version),
Warnings: aws.StringValueSlice(resp.Warnings),
// TODO[pulumi/lumi#198] Exposing array-valued output properties BinaryMediaTypes: aws.StringValueSlice(resp.BinaryMediaTypes),
// currently triggers failures serializing resource state, so
// supressing these properties.
// Warnings: aws.StringValueSlice(resp.Warnings),
// BinaryMediaTypes: aws.StringValueSlice(resp.BinaryMediaTypes),
}, nil }, nil
} }

View file

@ -185,6 +185,8 @@ type RestAPI struct {
ID string `json:"id,omitempty"` ID string `json:"id,omitempty"`
CreatedDate string `json:"createdDate,omitempty"` CreatedDate string `json:"createdDate,omitempty"`
Version string `json:"version,omitempty"` Version string `json:"version,omitempty"`
Warnings []string `json:"warnings,omitempty"`
BinaryMediaTypes []string `json:"binaryMediaTypes,omitempty"`
} }
// RestAPI's properties have constants to make dealing with diffs and property bags easier. // RestAPI's properties have constants to make dealing with diffs and property bags easier.
@ -200,6 +202,8 @@ const (
RestAPI_ID = "id" RestAPI_ID = "id"
RestAPI_CreatedDate = "createdDate" RestAPI_CreatedDate = "createdDate"
RestAPI_Version = "version" RestAPI_Version = "version"
RestAPI_Warnings = "warnings"
RestAPI_BinaryMediaTypes = "binaryMediaTypes"
) )
/* Marshalable S3Location structure(s) */ /* Marshalable S3Location structure(s) */