ProductStackHistory
A Construct that contains a Service Catalog product stack with its previous deployments maintained.
Example
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(),
],
});
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()
]
)
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();
// 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() }
});
// 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
new ProductStackHistory(scope: Construct, id: string, props: ProductStackHistoryProps)
ProductStackHistory(scope: Construct, id: str, props: ProductStackHistoryProps)
new ProductStackHistory(Construct scope, String id, ProductStackHistoryProps props)
new ProductStackHistory(Construct scope, string id, ProductStackHistoryProps props)
NewProductStackHistory(Scope Construct, Id *string, Props ProductStackHistoryProps)
Construct Props
currentVersionLockedbooleancurrent_version_lockedboolcurrentVersionLockedBooleanCurrentVersionLockedboolCurrentVersionLocked*boolrequired#currentVersionNamestringcurrent_version_namestrcurrentVersionNameStringCurrentVersionNamestringCurrentVersionName*stringrequired#descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#Default: No description provided
directoryoptionalstringdirectoryoptionalstrdirectoryoptionalStringDirectoryoptionalstringDirectoryoptional*string= 'product-stack-snapshots'#productStackProductStackproduct_stackProductStackproductStackProductStackProductStackProductStackProductStackProductStackrequired#validateTemplateoptionalbooleanvalidate_templateoptionalboolvalidateTemplateoptionalBooleanValidateTemplateoptionalboolValidateTemplateoptional*bool= true#If turned off, an invalid template configuration can be stored.
Properties
Methods
currentVersion(): CloudFormationProductVersiondef current_version(self, ) -> CloudFormationProductVersionpublic CloudFormationProductVersion currentVersion()public CloudFormationProductVersion CurrentVersion()func CurrentVersion() CloudFormationProductVersion#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#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#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#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#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