Implement the remaining get functions

This commit is contained in:
joeduffy 2017-05-31 16:06:30 -07:00
parent 4d63e6d672
commit 1d8835a810
48 changed files with 280 additions and 85 deletions

View file

@ -27,6 +27,10 @@ type ApplicationVersion struct {
idl.NamedResource
// Name of the Elastic Beanstalk application that is associated with this application version.
Application *Application `lumi:"application,replaces"`
// An optional version label name. If you don't specify one, a unique physical ID will be generated and
// used instead. If you specify a name, you cannot perform updates that require replacement of this resource. You
// can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
VersionLabel *string `lumi:"versionLabel,optional,replaces"`
// A description of this application version.
Description *string `lumi:"description,optional"`
// The source bundle for this application version. This supports all the usual Lumi asset schemes, in addition

View file

@ -9,6 +9,7 @@ import {Object} from "../s3/object";
export class ApplicationVersion extends lumi.Resource implements ApplicationVersionArgs {
public readonly name: string;
public readonly application: Application;
public readonly versionLabel?: string;
public description?: string;
public readonly sourceBundle: Object;
@ -22,6 +23,7 @@ export class ApplicationVersion extends lumi.Resource implements ApplicationVers
throw new Error("Missing required argument 'application'");
}
this.application = args.application;
this.versionLabel = args.versionLabel;
this.description = args.description;
if (args.sourceBundle === undefined) {
throw new Error("Missing required argument 'sourceBundle'");
@ -32,6 +34,7 @@ export class ApplicationVersion extends lumi.Resource implements ApplicationVers
export interface ApplicationVersionArgs {
readonly application: Application;
readonly versionLabel?: string;
description?: string;
readonly sourceBundle: Object;
}

View file

@ -19,12 +19,19 @@ import (
"github.com/pulumi/lumi/pkg/resource"
)
// This file contains handy factories for creating all sorts of AWS resource ARNs. In the fullness of time, it should
// This file contains constants and factories for all sorts of AWS resource ARNs. In the fullness of time, it should
// contain all of those listed at http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html. We are
// implementing them "as we go", however, so please feel free to add any that you need and which are presently missing.
const (
EC2 = "ec2"
EC2Instance = "intance"
EC2SecurityGroup = "security-group"
EC2VPC = "vpc"
)
func NewEC2Instance(region, accountID, id string) ARN {
return NewResource("ec2", region, accountID, "instance", id)
return NewResource(EC2, region, accountID, EC2Instance, id)
}
func NewEC2InstanceID(region, accountID, id string) resource.ID {
@ -32,7 +39,7 @@ func NewEC2InstanceID(region, accountID, id string) resource.ID {
}
func NewEC2SecurityGroup(region, accountID, id string) ARN {
return NewResource("ec2", region, accountID, "security-group", id)
return NewResource(EC2, region, accountID, EC2SecurityGroup, id)
}
func NewEC2SecurityGroupID(region, accountID, id string) resource.ID {
@ -40,15 +47,22 @@ func NewEC2SecurityGroupID(region, accountID, id string) resource.ID {
}
func NewEC2VPC(region, accountID, id string) ARN {
return NewResource("ec2", region, accountID, "vpc", id)
return NewResource(EC2, region, accountID, EC2VPC, id)
}
func NewEC2VPCID(region, accountID, id string) resource.ID {
return resource.ID(NewEC2VPC(region, accountID, id))
}
const (
ElasticBeanstalk = "elasticbeanstalk"
ElasticBeanstalkApplication = "application"
ElasticBeanstalkApplicationVersion = "applicationversion"
ElasticBeanstalkEnvironment = "environment"
)
func NewElasticBeanstalkApplication(region, accountID, name string) ARN {
return NewResourceAlt("elasticbeanstalk", region, accountID, "application", name)
return NewResourceAlt(ElasticBeanstalk, region, accountID, ElasticBeanstalkApplication, name)
}
func NewElasticBeanstalkApplicationID(region, accountID, name string) resource.ID {
@ -56,8 +70,8 @@ func NewElasticBeanstalkApplicationID(region, accountID, name string) resource.I
}
func NewElasticBeanstalkApplicationVersion(region, accountID, appname, versionlabel string) ARN {
return NewResourceAlt("elasticbeanstalk", region, accountID,
"applicationversion", appname+arnPathDelimiter+versionlabel)
return NewResourceAlt(ElasticBeanstalk, region, accountID,
ElasticBeanstalkApplicationVersion, appname+arnPathDelimiter+versionlabel)
}
func NewElasticBeanstalkApplicationVersionID(region, accountID, appname, versionlabel string) resource.ID {
@ -65,16 +79,20 @@ func NewElasticBeanstalkApplicationVersionID(region, accountID, appname, version
}
func NewElasticBeanstalkEnvironment(region, accountID, appname, envname string) ARN {
return NewResourceAlt("elasticbeanstalk", region, accountID,
"applicationversion", appname+arnPathDelimiter+envname)
return NewResourceAlt(ElasticBeanstalk, region, accountID,
ElasticBeanstalkEnvironment, appname+arnPathDelimiter+envname)
}
const (
S3 = "S3"
)
func NewElasticBeanstalkEnvironmentID(region, accountID, appname, envname string) resource.ID {
return resource.ID(NewElasticBeanstalkApplicationVersion(region, accountID, appname, envname))
}
func NewS3Bucket(bucket string) ARN {
return NewResource("s3", "", "", "", bucket)
return NewResource(S3, "", "", "", bucket)
}
func NewS3BucketID(bucket string) resource.ID {
@ -82,7 +100,7 @@ func NewS3BucketID(bucket string) resource.ID {
}
func NewS3Object(bucket, key string) ARN {
return NewResource("s3", "", "", "", bucket+arnPathDelimiter+key)
return NewResource(S3, "", "", "", bucket+arnPathDelimiter+key)
}
func NewS3ObjectID(bucket, key string) resource.ID {

View file

@ -17,7 +17,6 @@ package dynamodb
import (
"crypto/sha1"
"errors"
"fmt"
"reflect"
@ -48,6 +47,16 @@ const (
maxGlobalSecondaryIndexes = 5
)
const (
// hashKeyAttribute is a partition key, also known as its hash attribute. The term "hash attribute" derives from
// DynamoDB's usage of an internal hash function to evenly distribute data items across partitions based on their
// partition key values.
hashKeyAttribute = "HASH"
// rangeKeyType is a sort key, also known as its range attribute. The term "range attribute" derives from the way
// DynamoDB stores items with the same partition key physically close together, sorted by the sort key value.
rangeKeyAttribute = "RANGE"
)
// NewTableProvider creates a provider that handles DynamoDB Table operations.
func NewTableProvider(ctx *awsctx.Context) lumirpc.ResourceProviderServer {
ops := &tableProvider{ctx}
@ -166,13 +175,13 @@ func (p *tableProvider) Create(ctx context.Context, obj *dynamodb.Table) (resour
keySchema := []*awsdynamodb.KeySchemaElement{
{
AttributeName: aws.String(obj.HashKey),
KeyType: aws.String("HASH"),
KeyType: aws.String(hashKeyAttribute),
},
}
if obj.RangeKey != nil {
keySchema = append(keySchema, &awsdynamodb.KeySchemaElement{
AttributeName: obj.RangeKey,
KeyType: aws.String("RANGE"),
KeyType: aws.String(rangeKeyAttribute),
})
}
create := &awsdynamodb.CreateTableInput{
@ -190,13 +199,13 @@ func (p *tableProvider) Create(ctx context.Context, obj *dynamodb.Table) (resour
keySchema := []*awsdynamodb.KeySchemaElement{
{
AttributeName: aws.String(gsi.HashKey),
KeyType: aws.String("HASH"),
KeyType: aws.String(hashKeyAttribute),
},
}
if gsi.RangeKey != nil {
keySchema = append(keySchema, &awsdynamodb.KeySchemaElement{
AttributeName: gsi.RangeKey,
KeyType: aws.String("RANGE"),
KeyType: aws.String(rangeKeyAttribute),
})
}
gsis = append(gsis, &awsdynamodb.GlobalSecondaryIndex{
@ -236,7 +245,77 @@ func (p *tableProvider) Create(ctx context.Context, obj *dynamodb.Table) (resour
// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *tableProvider) Get(ctx context.Context, id resource.ID) (*dynamodb.Table, error) {
return nil, errors.New("Not yet implemented")
name, err := arn.ParseResourceName(id)
if err != nil {
if awsctx.IsAWSError(err, "ResourceNotFoundException") {
return nil, nil
}
return nil, err
}
resp, err := p.ctx.DynamoDB().DescribeTable(&awsdynamodb.DescribeTableInput{TableName: aws.String(name)})
if err != nil {
return nil, err
}
// The object was found, we need to reverse map a bunch of properties into the structure form.
contract.Assert(resp != nil)
contract.Assert(resp.Table != nil)
tab := resp.Table
var attributes []dynamodb.Attribute
for _, attr := range tab.AttributeDefinitions {
attributes = append(attributes, dynamodb.Attribute{
Name: *attr.AttributeName,
Type: dynamodb.AttributeType(*attr.AttributeType),
})
}
hashKey, rangeKey := getHashRangeKeys(tab.KeySchema)
var gsis *[]dynamodb.GlobalSecondaryIndex
if len(tab.GlobalSecondaryIndexes) > 0 {
var gis []dynamodb.GlobalSecondaryIndex
for _, gsid := range tab.GlobalSecondaryIndexes {
hk, rk := getHashRangeKeys(gsid.KeySchema)
gis = append(gis, dynamodb.GlobalSecondaryIndex{
IndexName: *gsid.IndexName,
HashKey: hk,
ReadCapacity: float64(*gsid.ProvisionedThroughput.ReadCapacityUnits),
WriteCapacity: float64(*gsid.ProvisionedThroughput.WriteCapacityUnits),
RangeKey: rk,
NonKeyAttributes: aws.StringValueSlice(gsid.Projection.NonKeyAttributes),
ProjectionType: dynamodb.ProjectionType(*gsid.Projection.ProjectionType),
})
}
gsis = &gis
}
return &dynamodb.Table{
HashKey: hashKey,
Attributes: attributes,
ReadCapacity: float64(*tab.ProvisionedThroughput.ReadCapacityUnits),
WriteCapacity: float64(*tab.ProvisionedThroughput.WriteCapacityUnits),
RangeKey: rangeKey,
TableName: tab.TableName,
GlobalSecondaryIndexes: gsis,
}, nil
}
func getHashRangeKeys(schema []*awsdynamodb.KeySchemaElement) (string, *string) {
var hashKey *string
var rangeKey *string
for _, elem := range schema {
switch *elem.KeyType {
case hashKeyAttribute:
hashKey = elem.AttributeName
case rangeKeyAttribute:
rangeKey = elem.AttributeName
default:
contract.Failf("Unexpected key schema attribute type: %v", *elem.KeyType)
}
}
contract.Assertf(hashKey != nil, "Expected to discover a hash partition key")
return *hashKey, rangeKey
}
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.
@ -296,13 +375,13 @@ func (p *tableProvider) Update(ctx context.Context, id resource.ID,
keySchema := []*awsdynamodb.KeySchemaElement{
{
AttributeName: aws.String(gsi.HashKey),
KeyType: aws.String("HASH"),
KeyType: aws.String(hashKeyAttribute),
},
}
if gsi.RangeKey != nil {
keySchema = append(keySchema, &awsdynamodb.KeySchemaElement{
AttributeName: gsi.RangeKey,
KeyType: aws.String("RANGE"),
KeyType: aws.String(rangeKeyAttribute),
})
}
var attributeDefinitions []*awsdynamodb.AttributeDefinition
@ -400,9 +479,9 @@ func (p *tableProvider) Delete(ctx context.Context, id resource.ID) error {
TableName: aws.String(name),
})
if err != nil {
if awsctx.IsAWSError(err, "ResourceNotFoundException") {
if awsctx.IsAWSError(err, awsdynamodb.ErrCodeResourceNotFoundException) {
return true, nil
} else if awsctx.IsAWSError(err, "ResourceInUseException") {
} else if awsctx.IsAWSError(err, awsdynamodb.ErrCodeResourceInUseException) {
return false, nil
}
return false, err // anything else is a real error; propagate it.

View file

@ -22,8 +22,8 @@ import (
"github.com/aws/aws-sdk-go/aws"
awselasticbeanstalk "github.com/aws/aws-sdk-go/service/elasticbeanstalk"
"github.com/pkg/errors"
"github.com/pulumi/lumi/pkg/resource"
"github.com/pulumi/lumi/pkg/util/contract"
"github.com/pulumi/lumi/pkg/util/mapper"
"github.com/pulumi/lumi/sdk/go/pkg/lumirpc"
"golang.org/x/net/context"
@ -101,7 +101,25 @@ func (p *applicationProvider) Create(ctx context.Context, obj *elasticbeanstalk.
// Read reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *applicationProvider) Get(ctx context.Context, id resource.ID) (*elasticbeanstalk.Application, error) {
return nil, errors.New("Not yet implemented")
name, err := arn.ParseResourceName(id)
if err != nil {
return nil, err
}
resp, err := p.ctx.ElasticBeanstalk().DescribeApplications(&awselasticbeanstalk.DescribeApplicationsInput{
ApplicationNames: []*string{aws.String(name)},
})
if err != nil {
return nil, err
} else if len(resp.Applications) == 0 {
return nil, nil
}
contract.Assert(len(resp.Applications) == 1)
app := resp.Applications[0]
contract.Assert(*app.ApplicationName == name)
return &elasticbeanstalk.Application{
ApplicationName: app.ApplicationName,
Description: app.Description,
}, nil
}
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.

View file

@ -19,11 +19,9 @@ import (
"crypto/sha1"
"fmt"
"reflect"
"strings"
"github.com/aws/aws-sdk-go/aws"
awselasticbeanstalk "github.com/aws/aws-sdk-go/service/elasticbeanstalk"
"github.com/pkg/errors"
"github.com/pulumi/lumi/pkg/resource"
"github.com/pulumi/lumi/pkg/util/contract"
"github.com/pulumi/lumi/pkg/util/mapper"
@ -70,33 +68,70 @@ func (p *applicationVersionProvider) Create(ctx context.Context,
if err != nil {
return "", err
}
versionLabel := resource.NewUniqueHex(obj.Name+"-", maxApplicationName, sha1.Size)
s3ObjectID := obj.SourceBundle.String()
s3Parts := strings.SplitN(s3ObjectID, "/", 2)
contract.Assertf(len(s3Parts) == 2, "Expected S3 Object resource ID to be of the form <bucket>/<key>")
create := &awselasticbeanstalk.CreateApplicationVersionInput{
ApplicationName: aws.String(appname),
Description: obj.Description,
SourceBundle: &awselasticbeanstalk.S3Location{
S3Bucket: aws.String(s3Parts[0]),
S3Key: aws.String(s3Parts[1]),
},
VersionLabel: aws.String(versionLabel),
// Autogenerate a version label that is unique.
var versionLabel string
if obj.VersionLabel != nil {
versionLabel = *obj.VersionLabel
} else {
versionLabel = resource.NewUniqueHex(obj.Name+"-", maxApplicationName, sha1.Size)
}
fmt.Printf("Creating ElasticBeanstalk ApplicationVersion '%v' with version label '%v'\n", obj.Name, versionLabel)
if _, err := p.ctx.ElasticBeanstalk().CreateApplicationVersion(create); err != nil {
// Parse out the S3 bucket and key components so we can create the source bundle.
s3buck, s3key, err := arn.ParseResourceNamePair(obj.SourceBundle)
if err != nil {
return "", err
}
fmt.Printf("Creating ElasticBeanstalk ApplicationVersion '%v' with version label '%v'\n", obj.Name, versionLabel)
if _, err := p.ctx.ElasticBeanstalk().CreateApplicationVersion(
&awselasticbeanstalk.CreateApplicationVersionInput{
ApplicationName: aws.String(appname),
Description: obj.Description,
SourceBundle: &awselasticbeanstalk.S3Location{
S3Bucket: aws.String(s3buck),
S3Key: aws.String(s3key),
},
VersionLabel: aws.String(versionLabel),
},
); err != nil {
return "", err
}
return arn.NewElasticBeanstalkApplicationVersionID(p.ctx.Region(), p.ctx.AccountID(), appname, versionLabel), nil
}
// Read reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *applicationVersionProvider) Get(ctx context.Context,
id resource.ID) (*elasticbeanstalk.ApplicationVersion, error) {
// TODO: Can almost just use p.getApplicationVersion to implement this, but there is no way to get the `resource.ID`
// for the SourceBundle S3 object returned from the AWS API.
return nil, errors.New("Not yet implemented")
idarn, err := arn.ARN(id).Parse()
if err != nil {
return nil, err
}
appname, version := idarn.ResourceNamePair()
resp, err := p.ctx.ElasticBeanstalk().DescribeApplicationVersions(
&awselasticbeanstalk.DescribeApplicationVersionsInput{
ApplicationName: aws.String(appname),
VersionLabels: []*string{aws.String(version)},
},
)
if err != nil {
return nil, err
} else if len(resp.ApplicationVersions) == 0 {
return nil, nil
}
contract.Assert(len(resp.ApplicationVersions) == 1)
vers := resp.ApplicationVersions[0]
contract.Assert(*vers.ApplicationName == appname)
appid := arn.NewElasticBeanstalkApplication(idarn.Region, idarn.AccountID, appname)
contract.Assert(*vers.VersionLabel == version)
return &elasticbeanstalk.ApplicationVersion{
VersionLabel: vers.VersionLabel,
Application: resource.ID(appid),
Description: vers.Description,
SourceBundle: arn.NewS3ObjectID(*vers.SourceBundle.S3Bucket, *vers.SourceBundle.S3Key),
}, nil
}
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.

View file

@ -106,7 +106,23 @@ func (p *buckProvider) Create(ctx context.Context, obj *s3.Bucket) (resource.ID,
// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *buckProvider) Get(ctx context.Context, id resource.ID) (*s3.Bucket, error) {
return nil, errors.New("Not yet implemented")
name, err := arn.ParseResourceName(id)
if err != nil {
return nil, err
}
if _, err := p.ctx.S3().GetBucketAcl(&awss3.GetBucketAclInput{Bucket: aws.String(name)}); err != nil {
if awsctx.IsAWSError(err, "NotFound", "NoSuchBucket") {
return nil, nil
}
return nil, err
}
// Note that the canned ACL cannot be recreated from the GetBucketAclInput call, because it will have been expanded
// out into its constituent grants/owner parts; so we just retain the existing value on the receiver's side.
return &s3.Bucket{
BucketName: &name,
}, nil
}
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.

View file

@ -111,7 +111,24 @@ func (p *objProvider) Create(ctx context.Context, obj *s3.Object) (resource.ID,
// Get reads the instance state identified by ID, returning a populated resource object, or an error if not found.
func (p *objProvider) Get(ctx context.Context, id resource.ID) (*s3.Object, error) {
return nil, errors.New("Not yet implemented")
buck, key, err := arn.ParseResourceNamePair(id)
if err != nil {
return nil, err
}
if _, err := p.ctx.S3().GetObject(&awss3.GetObjectInput{
Bucket: aws.String(buck),
Key: aws.String(key),
}); err != nil {
if awsctx.IsAWSError(err, "NotFound", "NoSuchKey") {
return nil, nil
}
return nil, err
}
return &s3.Object{
Bucket: resource.ID(arn.NewS3Bucket(buck)),
Key: key,
Source: resource.NewURIAsset(fmt.Sprintf("s3://%v/%v", buck, key)),
}, nil
}
// InspectChange checks what impacts a hypothetical update will have on the resource's properties.

View file

@ -165,7 +165,7 @@ func (p *AccountProvider) Delete(
func (p *AccountProvider) Unmarshal(
v *pbstruct.Struct) (*Account, resource.PropertyMap, mapper.DecodeError) {
var obj Account
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -168,7 +168,7 @@ func (p *APIKeyProvider) Delete(
func (p *APIKeyProvider) Unmarshal(
v *pbstruct.Struct) (*APIKey, resource.PropertyMap, mapper.DecodeError) {
var obj APIKey
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -165,7 +165,7 @@ func (p *AuthorizerProvider) Delete(
func (p *AuthorizerProvider) Unmarshal(
v *pbstruct.Struct) (*Authorizer, resource.PropertyMap, mapper.DecodeError) {
var obj Authorizer
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -165,7 +165,7 @@ func (p *BasePathMappingProvider) Delete(
func (p *BasePathMappingProvider) Unmarshal(
v *pbstruct.Struct) (*BasePathMapping, resource.PropertyMap, mapper.DecodeError) {
var obj BasePathMapping
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -165,7 +165,7 @@ func (p *ClientCertificateProvider) Delete(
func (p *ClientCertificateProvider) Unmarshal(
v *pbstruct.Struct) (*ClientCertificate, resource.PropertyMap, mapper.DecodeError) {
var obj ClientCertificate
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -165,7 +165,7 @@ func (p *DeploymentProvider) Delete(
func (p *DeploymentProvider) Unmarshal(
v *pbstruct.Struct) (*Deployment, resource.PropertyMap, mapper.DecodeError) {
var obj Deployment
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -213,7 +213,7 @@ func (p *MethodProvider) Delete(
func (p *MethodProvider) Unmarshal(
v *pbstruct.Struct) (*Method, resource.PropertyMap, mapper.DecodeError) {
var obj Method
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -174,7 +174,7 @@ func (p *ModelProvider) Delete(
func (p *ModelProvider) Unmarshal(
v *pbstruct.Struct) (*Model, resource.PropertyMap, mapper.DecodeError) {
var obj Model
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -174,7 +174,7 @@ func (p *ResourceProvider) Delete(
func (p *ResourceProvider) Unmarshal(
v *pbstruct.Struct) (*Resource, resource.PropertyMap, mapper.DecodeError) {
var obj Resource
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -165,7 +165,7 @@ func (p *RestAPIProvider) Delete(
func (p *RestAPIProvider) Unmarshal(
v *pbstruct.Struct) (*RestAPI, resource.PropertyMap, mapper.DecodeError) {
var obj RestAPI
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -171,7 +171,7 @@ func (p *StageProvider) Delete(
func (p *StageProvider) Unmarshal(
v *pbstruct.Struct) (*Stage, resource.PropertyMap, mapper.DecodeError) {
var obj Stage
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -209,7 +209,7 @@ func (p *UsagePlanProvider) Delete(
func (p *UsagePlanProvider) Unmarshal(
v *pbstruct.Struct) (*UsagePlan, resource.PropertyMap, mapper.DecodeError) {
var obj UsagePlan
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -171,7 +171,7 @@ func (p *UsagePlanKeyProvider) Delete(
func (p *UsagePlanKeyProvider) Unmarshal(
v *pbstruct.Struct) (*UsagePlanKey, resource.PropertyMap, mapper.DecodeError) {
var obj UsagePlanKey
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -170,7 +170,7 @@ func (p *ActionTargetProvider) Delete(
func (p *ActionTargetProvider) Unmarshal(
v *pbstruct.Struct) (*ActionTarget, resource.PropertyMap, mapper.DecodeError) {
var obj ActionTarget
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}
@ -344,7 +344,7 @@ func (p *AlarmProvider) Delete(
func (p *AlarmProvider) Unmarshal(
v *pbstruct.Struct) (*Alarm, resource.PropertyMap, mapper.DecodeError) {
var obj Alarm
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -212,7 +212,7 @@ func (p *TableProvider) Delete(
func (p *TableProvider) Unmarshal(
v *pbstruct.Struct) (*Table, resource.PropertyMap, mapper.DecodeError) {
var obj Table
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -165,7 +165,7 @@ func (p *InstanceProvider) Delete(
func (p *InstanceProvider) Unmarshal(
v *pbstruct.Struct) (*Instance, resource.PropertyMap, mapper.DecodeError) {
var obj Instance
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -165,7 +165,7 @@ func (p *InternetGatewayProvider) Delete(
func (p *InternetGatewayProvider) Unmarshal(
v *pbstruct.Struct) (*InternetGateway, resource.PropertyMap, mapper.DecodeError) {
var obj InternetGateway
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -177,7 +177,7 @@ func (p *RouteProvider) Delete(
func (p *RouteProvider) Unmarshal(
v *pbstruct.Struct) (*Route, resource.PropertyMap, mapper.DecodeError) {
var obj Route
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -168,7 +168,7 @@ func (p *RouteTableProvider) Delete(
func (p *RouteTableProvider) Unmarshal(
v *pbstruct.Struct) (*RouteTable, resource.PropertyMap, mapper.DecodeError) {
var obj RouteTable
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -174,7 +174,7 @@ func (p *SecurityGroupProvider) Delete(
func (p *SecurityGroupProvider) Unmarshal(
v *pbstruct.Struct) (*SecurityGroup, resource.PropertyMap, mapper.DecodeError) {
var obj SecurityGroup
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -189,7 +189,7 @@ func (p *SecurityGroupEgressProvider) Delete(
func (p *SecurityGroupEgressProvider) Unmarshal(
v *pbstruct.Struct) (*SecurityGroupEgress, resource.PropertyMap, mapper.DecodeError) {
var obj SecurityGroupEgress
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -195,7 +195,7 @@ func (p *SecurityGroupIngressProvider) Delete(
func (p *SecurityGroupIngressProvider) Unmarshal(
v *pbstruct.Struct) (*SecurityGroupIngress, resource.PropertyMap, mapper.DecodeError) {
var obj SecurityGroupIngress
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -174,7 +174,7 @@ func (p *SubnetProvider) Delete(
func (p *SubnetProvider) Unmarshal(
v *pbstruct.Struct) (*Subnet, resource.PropertyMap, mapper.DecodeError) {
var obj Subnet
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -171,7 +171,7 @@ func (p *VPCProvider) Delete(
func (p *VPCProvider) Unmarshal(
v *pbstruct.Struct) (*VPC, resource.PropertyMap, mapper.DecodeError) {
var obj VPC
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -171,7 +171,7 @@ func (p *VPCGatewayAttachmentProvider) Delete(
func (p *VPCGatewayAttachmentProvider) Unmarshal(
v *pbstruct.Struct) (*VPCGatewayAttachment, resource.PropertyMap, mapper.DecodeError) {
var obj VPCGatewayAttachment
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -171,7 +171,7 @@ func (p *VPCPeeringConnectionProvider) Delete(
func (p *VPCPeeringConnectionProvider) Unmarshal(
v *pbstruct.Struct) (*VPCPeeringConnection, resource.PropertyMap, mapper.DecodeError) {
var obj VPCPeeringConnection
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -168,7 +168,7 @@ func (p *ApplicationProvider) Delete(
func (p *ApplicationProvider) Unmarshal(
v *pbstruct.Struct) (*Application, resource.PropertyMap, mapper.DecodeError) {
var obj Application
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -126,6 +126,9 @@ func (p *ApplicationVersionProvider) InspectChange(
if diff.Changed("application") {
replaces = append(replaces, "application")
}
if diff.Changed("versionLabel") {
replaces = append(replaces, "versionLabel")
}
if diff.Changed("sourceBundle") {
replaces = append(replaces, "sourceBundle")
}
@ -171,7 +174,7 @@ func (p *ApplicationVersionProvider) Delete(
func (p *ApplicationVersionProvider) Unmarshal(
v *pbstruct.Struct) (*ApplicationVersion, resource.PropertyMap, mapper.DecodeError) {
var obj ApplicationVersion
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}
@ -182,6 +185,7 @@ func (p *ApplicationVersionProvider) Unmarshal(
type ApplicationVersion struct {
Name string `json:"name"`
Application resource.ID `json:"application"`
VersionLabel *string `json:"versionLabel,omitempty"`
Description *string `json:"description,omitempty"`
SourceBundle resource.ID `json:"sourceBundle"`
}
@ -190,6 +194,7 @@ type ApplicationVersion struct {
const (
ApplicationVersion_Name = "name"
ApplicationVersion_Application = "application"
ApplicationVersion_VersionLabel = "versionLabel"
ApplicationVersion_Description = "description"
ApplicationVersion_SourceBundle = "sourceBundle"
)

View file

@ -183,7 +183,7 @@ func (p *EnvironmentProvider) Delete(
func (p *EnvironmentProvider) Unmarshal(
v *pbstruct.Struct) (*Environment, resource.PropertyMap, mapper.DecodeError) {
var obj Environment
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -168,7 +168,7 @@ func (p *GroupProvider) Delete(
func (p *GroupProvider) Unmarshal(
v *pbstruct.Struct) (*Group, resource.PropertyMap, mapper.DecodeError) {
var obj Group
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -179,7 +179,7 @@ func (p *PolicyProvider) Delete(
func (p *PolicyProvider) Unmarshal(
v *pbstruct.Struct) (*Policy, resource.PropertyMap, mapper.DecodeError) {
var obj Policy
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -173,7 +173,7 @@ func (p *RoleProvider) Delete(
func (p *RoleProvider) Unmarshal(
v *pbstruct.Struct) (*Role, resource.PropertyMap, mapper.DecodeError) {
var obj Role
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -182,7 +182,7 @@ func (p *UserProvider) Delete(
func (p *UserProvider) Unmarshal(
v *pbstruct.Struct) (*User, resource.PropertyMap, mapper.DecodeError) {
var obj User
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -165,7 +165,7 @@ func (p *KeyProvider) Delete(
func (p *KeyProvider) Unmarshal(
v *pbstruct.Struct) (*Key, resource.PropertyMap, mapper.DecodeError) {
var obj Key
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -179,7 +179,7 @@ func (p *FunctionProvider) Delete(
func (p *FunctionProvider) Unmarshal(
v *pbstruct.Struct) (*Function, resource.PropertyMap, mapper.DecodeError) {
var obj Function
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -182,7 +182,7 @@ func (p *PermissionProvider) Delete(
func (p *PermissionProvider) Unmarshal(
v *pbstruct.Struct) (*Permission, resource.PropertyMap, mapper.DecodeError) {
var obj Permission
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -168,7 +168,7 @@ func (p *BucketProvider) Delete(
func (p *BucketProvider) Unmarshal(
v *pbstruct.Struct) (*Bucket, resource.PropertyMap, mapper.DecodeError) {
var obj Bucket
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -165,7 +165,7 @@ func (p *ObjectProvider) Delete(
func (p *ObjectProvider) Unmarshal(
v *pbstruct.Struct) (*Object, resource.PropertyMap, mapper.DecodeError) {
var obj Object
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -168,7 +168,7 @@ func (p *TopicProvider) Delete(
func (p *TopicProvider) Unmarshal(
v *pbstruct.Struct) (*Topic, resource.PropertyMap, mapper.DecodeError) {
var obj Topic
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}

View file

@ -171,7 +171,7 @@ func (p *QueueProvider) Delete(
func (p *QueueProvider) Unmarshal(
v *pbstruct.Struct) (*Queue, resource.PropertyMap, mapper.DecodeError) {
var obj Queue
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{})
props := resource.UnmarshalProperties(nil, v, resource.MarshalOptions{RawResources: true})
result := mapper.MapIU(props.Mappable(), &obj)
return &obj, props, result
}