Skip to content
v2.275.0

ProductStackHistory ​

A Construct that contains a Service Catalog product stack with its previous deployments maintained.

Example ​

ts
class S3BucketProduct extends servicecatalog.ProductStack {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    new s3.Bucket(this, 'BucketProductV2');
  }
}

const productStackHistory = new servicecatalog.ProductStackHistory(this, 'ProductStackHistory', {
  productStack: new S3BucketProduct(this, 'S3BucketProduct'),
  currentVersionName: 'v2',
  currentVersionLocked: true
});

const product = new servicecatalog.CloudFormationProduct(this, 'MyFirstProduct', {
  productName: "My Product",
  owner: "Product Owner",
  productVersions: [
    productStackHistory.currentVersion(),
  ],
});
python
class S3BucketProduct(servicecatalog.ProductStack):
    def __init__(self, scope, id):
        super().__init__(scope, id)

        s3.Bucket(self, "BucketProductV2")

product_stack_history = servicecatalog.ProductStackHistory(self, "ProductStackHistory",
    product_stack=S3BucketProduct(self, "S3BucketProduct"),
    current_version_name="v2",
    current_version_locked=True
)

product = servicecatalog.CloudFormationProduct(self, "MyFirstProduct",
    product_name="My Product",
    owner="Product Owner",
    product_versions=[
        product_stack_history.current_version()
    ]
)
java
public class S3BucketProduct extends ProductStack {
    public S3BucketProduct(Construct scope, String id) {
        super(scope, id);

        new Bucket(this, "BucketProductV2");
    }
}

ProductStackHistory productStackHistory = ProductStackHistory.Builder.create(this, "ProductStackHistory")
        .productStack(new S3BucketProduct(this, "S3BucketProduct"))
        .currentVersionName("v2")
        .currentVersionLocked(true)
        .build();

CloudFormationProduct product = CloudFormationProduct.Builder.create(this, "MyFirstProduct")
        .productName("My Product")
        .owner("Product Owner")
        .productVersions(List.of(productStackHistory.currentVersion()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
class S3BucketProduct : ProductStack
{
    public S3BucketProduct(Construct scope, string id) : base(scope, id)
    {

        new Bucket(this, "BucketProductV2");
    }
}

var productStackHistory = new ProductStackHistory(this, "ProductStackHistory", new ProductStackHistoryProps {
    ProductStack = new S3BucketProduct(this, "S3BucketProduct"),
    CurrentVersionName = "v2",
    CurrentVersionLocked = true
});

var product = new CloudFormationProduct(this, "MyFirstProduct", new CloudFormationProductProps {
    ProductName = "My Product",
    Owner = "Product Owner",
    ProductVersions = new [] { productStackHistory.CurrentVersion() }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
type s3BucketProduct struct {
	ProductStack
}

func newS3BucketProduct(scope Construct, id *string) *s3BucketProduct {
	this := &s3BucketProduct{}
	servicecatalog.NewProductStack_Override(this, scope, id)

	s3.NewBucket(this, jsii.String("BucketProductV2"))
	return this
}

productStackHistory := servicecatalog.NewProductStackHistory(this, jsii.String("ProductStackHistory"), &ProductStackHistoryProps{
	ProductStack: newS3BucketProduct(this, jsii.String("S3BucketProduct")),
	CurrentVersionName: jsii.String("v2"),
	CurrentVersionLocked: jsii.Boolean(true),
})

product := servicecatalog.NewCloudFormationProduct(this, jsii.String("MyFirstProduct"), &CloudFormationProductProps{
	ProductName: jsii.String("My Product"),
	Owner: jsii.String("Product Owner"),
	ProductVersions: []CloudFormationProductVersion{
		productStackHistory.CurrentVersion(),
	},
})

Initializer ​

ts
new ProductStackHistory(scope: Construct, id: string, props: ProductStackHistoryProps)
python
ProductStackHistory(scope: Construct, id: str, props: ProductStackHistoryProps)
java
new ProductStackHistory(Construct scope, String id, ProductStackHistoryProps props)
csharp
new ProductStackHistory(Construct scope, string id, ProductStackHistoryProps props)
go
NewProductStackHistory(Scope Construct, Id *string, Props ProductStackHistoryProps)

Construct Props ​

currentVersionLockedbooleancurrent_version_lockedboolcurrentVersionLockedBooleanCurrentVersionLockedboolCurrentVersionLocked*boolrequired#
If this is set to true, the ProductStack will not be overwritten if a snapshot is found for the currentVersionName.
currentVersionNamestringcurrent_version_namestrcurrentVersionNameStringCurrentVersionNamestringCurrentVersionName*stringrequired#
The current version name of the ProductStack.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#
The description of the product version.

Default: No description provided

directoryoptionalstringdirectoryoptionalstrdirectoryoptionalStringDirectoryoptionalstringDirectoryoptional*string= 'product-stack-snapshots'#
The directory where template snapshots will be stored.
productStackProductStackproduct_stackProductStackproductStackProductStackProductStackProductStackProductStackProductStackrequired#
The ProductStack whose history will be retained as a snapshot.
validateTemplateoptionalbooleanvalidate_templateoptionalboolvalidateTemplateoptionalBooleanValidateTemplateoptionalboolValidateTemplateoptional*bool= true#
Whether the specified product template will be validated by CloudFormation.

If turned off, an invalid template configuration can be stored.

Properties ​

nodeNodenodeNodenodeNodeNodeNodeNodeNode#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringstatic#
Uniquely identifies this class.

Methods ​

currentVersion(): CloudFormationProductVersiondef current_version(self, ) -> CloudFormationProductVersionpublic CloudFormationProductVersion currentVersion()public CloudFormationProductVersion CurrentVersion()func CurrentVersion() CloudFormationProductVersion#
Retains product stack template as a snapshot when deployed and retrieves a CloudFormationProductVersion for the current product version.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
versionFromSnapshot(productVersionName: string): CloudFormationProductVersiondef version_from_snapshot(self, product_version_name: str) -> CloudFormationProductVersionpublic CloudFormationProductVersion versionFromSnapshot(String productVersionName)public CloudFormationProductVersion VersionFromSnapshot(string productVersionName)func VersionFromSnapshot(ProductVersionName *string) CloudFormationProductVersion#
Retrieves a CloudFormationProductVersion from a previously deployed productVersionName.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

1 parameter · returns

Parameters

  • mixinsmixinsmixinsmixinsMixins — The mixins to apply.

Returns: This construct for chaining