Portfolio

class aws_cdk.aws_servicecatalog.Portfolio(scope, id, *, display_name, provider_name, description=None, message_language=None, tag_options=None)

Bases: Resource

A Service Catalog portfolio.

ExampleMetadata:

infused

Example:

servicecatalog.Portfolio(self, "Portfolio",
    display_name="MyPortfolio",
    provider_name="MyTeam"
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • display_name (str) – The name of the portfolio.

  • provider_name (str) – The provider name.

  • description (Optional[str]) – Description for portfolio. Default: - No description provided

  • message_language (Optional[MessageLanguage]) – The message language. Controls language for status logging and errors. Default: - English

  • tag_options (Optional[TagOptions]) – TagOptions associated directly to a portfolio. Default: - No tagOptions provided

Methods

add_product(product)

Associate portfolio with the given product.

Parameters:

product (IProduct) –

Return type:

None

apply_removal_policy(policy)

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:

policy (RemovalPolicy) –

Return type:

None

associate_tag_options(tag_options)

Associate Tag Options.

A TagOption is a key-value pair managed in AWS Service Catalog. It is not an AWS tag, but serves as a template for creating an AWS tag based on the TagOption.

Parameters:

tag_options (TagOptions) –

Return type:

None

constrain_cloud_formation_parameters(product, *, rule, description=None, message_language=None)

Set provisioning rules for the product.

Parameters:
  • product (IProduct) –

  • rule (Union[TemplateRule, Dict[str, Any]]) – The rule with condition and assertions to apply to template.

  • description (Optional[str]) – The description of the constraint. Default: - No description provided

  • message_language (Optional[MessageLanguage]) – The language code. Configures the language for error messages from service catalog. Default: - English

Return type:

None

constrain_tag_updates(product, *, allow=None, description=None, message_language=None)

Add a Resource Update Constraint.

Parameters:
  • product (IProduct) –

  • allow (Optional[bool]) – Toggle for if users should be allowed to change/update tags on provisioned products. Default: true

  • description (Optional[str]) – The description of the constraint. Default: - No description provided

  • message_language (Optional[MessageLanguage]) – The language code. Configures the language for error messages from service catalog. Default: - English

Return type:

None

deploy_with_stack_sets(product, *, accounts, admin_role, execution_role_name, regions, allow_stack_set_instance_operations=None, description=None, message_language=None)

Configure deployment options using AWS Cloudformation StackSets.

Parameters:
  • product (IProduct) –

  • accounts (Sequence[str]) – List of accounts to deploy stacks to.

  • admin_role (IRole) – IAM role used to administer the StackSets configuration.

  • execution_role_name (str) – IAM role used to provision the products in the Stacks.

  • regions (Sequence[str]) – List of regions to deploy stacks to.

  • allow_stack_set_instance_operations (Optional[bool]) – Wether to allow end users to create, update, and delete stacks. Default: false

  • description (Optional[str]) – The description of the constraint. Default: - No description provided

  • message_language (Optional[MessageLanguage]) – The language code. Configures the language for error messages from service catalog. Default: - English

Return type:

None

give_access_to_group(group)

Associate portfolio with an IAM Group.

Parameters:

group (IGroup) –

Return type:

None

give_access_to_role(role)

Associate portfolio with an IAM Role.

Parameters:

role (IRole) –

Return type:

None

give_access_to_user(user)

Associate portfolio with an IAM User.

Parameters:

user (IUser) –

Return type:

None

notify_on_stack_events(product, topic, *, description=None, message_language=None)

Add notifications for supplied topics on the provisioned product.

Parameters:
  • product (IProduct) –

  • topic (ITopic) –

  • description (Optional[str]) – The description of the constraint. Default: - No description provided

  • message_language (Optional[MessageLanguage]) – The language code. Configures the language for error messages from service catalog. Default: - English

Return type:

None

set_launch_role(product, launch_role, *, description=None, message_language=None)

Force users to assume a certain role when launching a product.

This sets the launch role using the role arn which is tied to the account this role exists in. This is useful if you will be provisioning products from the account where this role exists. If you intend to share the portfolio across accounts, use a local launch role.

Parameters:
  • product (IProduct) –

  • launch_role (IRole) –

  • description (Optional[str]) – The description of the constraint. Default: - No description provided

  • message_language (Optional[MessageLanguage]) – The language code. Configures the language for error messages from service catalog. Default: - English

Return type:

None

set_local_launch_role(product, launch_role, *, description=None, message_language=None)

Force users to assume a certain role when launching a product.

The role name will be referenced by in the local account and must be set explicitly. This is useful when sharing the portfolio with multiple accounts.

Parameters:
  • product (IProduct) –

  • launch_role (IRole) –

  • description (Optional[str]) – The description of the constraint. Default: - No description provided

  • message_language (Optional[MessageLanguage]) – The language code. Configures the language for error messages from service catalog. Default: - English

Return type:

None

set_local_launch_role_name(product, launch_role_name, *, description=None, message_language=None)

Force users to assume a certain role when launching a product.

The role will be referenced by name in the local account instead of a static role arn. A role with this name will automatically be created and assumable by Service Catalog in this account. This is useful when sharing the portfolio with multiple accounts.

Parameters:
  • product (IProduct) –

  • launch_role_name (str) –

  • description (Optional[str]) – The description of the constraint. Default: - No description provided

  • message_language (Optional[MessageLanguage]) – The language code. Configures the language for error messages from service catalog. Default: - English

Return type:

IRole

share_with_account(account_id, *, message_language=None, share_tag_options=None)

Initiate a portfolio share with another account.

Parameters:
  • account_id (str) –

  • message_language (Optional[MessageLanguage]) – The message language of the share. Controls status and error message language for share. Default: - English

  • share_tag_options (Optional[bool]) – Whether to share tagOptions as a part of the portfolio share. Default: - share not specified

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

env

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

node

The tree node.

portfolio_arn

The ARN of the portfolio.

portfolio_id

The ID of the portfolio.

stack

The stack in which this resource is defined.

Static Methods

classmethod from_portfolio_arn(scope, id, portfolio_arn)

Creates a Portfolio construct that represents an external portfolio.

Parameters:
  • scope (Construct) – The parent creating construct (usually this).

  • id (str) – The construct’s name.

  • portfolio_arn (str) – the Amazon Resource Name of the existing portfolio.

Return type:

IPortfolio

classmethod is_construct(x)

Checks if x is a construct.

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:

x (Any) – Any object.

Return type:

bool

Returns:

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

classmethod is_owned_resource(construct)

Returns true if the construct was created by CDK, and false otherwise.

Parameters:

construct (IConstruct) –

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct) –

Return type:

bool