Skip to content

update_portfolio_share

update_portfolio_share(
    portfolio_id: Id,
    *,
    config_overrides: Optional[ServiceCatalogClientConfig] = None,
    accept_language: Optional[AcceptLanguage] = None,
    account_id: Optional[AccountId] = None,
    organization_node: Optional[OrganizationNode] = None,
    share_tag_options: Optional[NullableBoolean] = None,
    share_principals: Optional[NullableBoolean] = None,
) -> UpdatePortfolioShareOutput

Updates the specified portfolio share. You can use this API to enable or disable TagOptions sharing or Principal sharing for an existing portfolio share.

The portfolio share cannot be updated if the CreatePortfolioShare operation is IN_PROGRESS, as the share is not available to recipient entities. In this case, you must wait for the portfolio share to be completed.

You must provide the accountId or organization node in the input, but not both.

If the portfolio is shared to both an external account and an organization node, and both shares need to be updated, you must invoke UpdatePortfolioShare separately for each share type.

This API cannot be used for removing the portfolio share. You must use DeletePortfolioShare API for that action.

When you associate a principal with portfolio, a potential privilege escalation path may occur when that portfolio is then shared with other accounts. For a user in a recipient account who is not an Service Catalog Admin, but still has the ability to create Principals (Users/Groups/Roles), that user could create a role that matches a principal name association for the portfolio. Although this user may not know which principal names are associated through Service Catalog, they may be able to guess the user. If this potential escalation path is a concern, then Service Catalog recommends using PrincipalType as IAM. With this configuration, the PrincipalARN must already exist in the recipient account before it can be associated.

Parameters:

  • accept_language (Optional[AcceptLanguage], default: None ) –

    The language code.

    • jp - Japanese

    • zh - Chinese

  • portfolio_id (Id) –

    The unique identifier of the portfolio for which the share will be updated.

  • account_id (Optional[AccountId], default: None ) –

    The Amazon Web Services account Id of the recipient account. This field is required when updating an external account to account type share.

  • share_tag_options (Optional[NullableBoolean], default: None ) –

    Enables or disables TagOptions sharing for the portfolio share. If this field is not provided, the current state of TagOptions sharing on the portfolio share will not be modified.

  • share_principals (Optional[NullableBoolean], default: None ) –

    A flag to enables or disables Principals sharing in the portfolio. If this field is not provided, the current state of the Principals sharing on the portfolio share will not be modified.

Raises:

Source code in docs_src/capo_service_catalog/_services/service_catalog.py
def update_portfolio_share(
    self,
    portfolio_id: "capo_service_catalog.types.id.Id",
    *,
    config_overrides: Optional[ServiceCatalogClientConfig] = None,
    accept_language: Optional[
        "capo_service_catalog.types.accept_language.AcceptLanguage"
    ] = None,
    account_id: Optional["capo_service_catalog.types.account_id.AccountId"] = None,
    organization_node: Optional[
        "capo_service_catalog.types.organization_node.OrganizationNode"
    ] = None,
    share_tag_options: Optional[
        "capo_service_catalog.types.nullable_boolean.NullableBoolean"
    ] = None,
    share_principals: Optional[
        "capo_service_catalog.types.nullable_boolean.NullableBoolean"
    ] = None,
) -> "capo_service_catalog.types.update_portfolio_share_output.UpdatePortfolioShareOutput":
    """<p>Updates the specified portfolio share. You can use this API to enable or disable <code>TagOptions</code> sharing or Principal sharing for an existing portfolio share. </p> <p>The portfolio share cannot be updated if the <code>CreatePortfolioShare</code> operation is <code>IN_PROGRESS</code>, as the share is not available to recipient entities. In this case, you must wait for the portfolio share to be completed.</p> <p>You must provide the <code>accountId</code> or organization node in the input, but not both.</p> <p>If the portfolio is shared to both an external account and an organization node, and both shares need to be updated, you must invoke <code>UpdatePortfolioShare</code> separately for each share type. </p> <p>This API cannot be used for removing the portfolio share. You must use <code>DeletePortfolioShare</code> API for that action. </p> <note> <p>When you associate a principal with portfolio, a potential privilege escalation path may occur when that portfolio is then shared with other accounts. For a user in a recipient account who is <i>not</i> an Service Catalog Admin, but still has the ability to create Principals (Users/Groups/Roles), that user could create a role that matches a principal name association for the portfolio. Although this user may not know which principal names are associated through Service Catalog, they may be able to guess the user. If this potential escalation path is a concern, then Service Catalog recommends using <code>PrincipalType</code> as <code>IAM</code>. With this configuration, the <code>PrincipalARN</code> must already exist in the recipient account before it can be associated. </p> </note>

    Args:
        accept_language: <p>The language code.</p> <ul> <li> <p> <code>jp</code> - Japanese</p> </li> <li> <p> <code>zh</code> - Chinese</p> </li> </ul>
        portfolio_id: <p>The unique identifier of the portfolio for which the share will be updated.</p>
        account_id: <p>The Amazon Web Services account Id of the recipient account. This field is required when updating an external account to account type share.</p>
        share_tag_options: <p>Enables or disables <code>TagOptions</code> sharing for the portfolio share. If this field is not provided, the current state of TagOptions sharing on the portfolio share will not be modified.</p>
        share_principals: <p>A flag to enables or disables <code>Principals</code> sharing in the portfolio. If this field is not provided, the current state of the <code>Principals</code> sharing on the portfolio share will not be modified. </p>

    Raises:
        capo_service_catalog.errors.invalid_parameters_exception.InvalidParametersException: <p>One or more parameters provided to the operation are not valid.</p>
        capo_service_catalog.errors.invalid_state_exception.InvalidStateException: <p>An attempt was made to modify a resource that is in a state that is not valid. Check your resources to ensure that they are in valid states before retrying the operation.</p>
        capo_service_catalog.errors.operation_not_supported_exception.OperationNotSupportedException: <p>The operation is not supported.</p>
        capo_service_catalog.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_service_catalog.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_service_catalog.types.update_portfolio_share_input.UpdatePortfolioShareInput]",
    ) -> OperationResponse[
        "capo_service_catalog.types.update_portfolio_share_output.UpdatePortfolioShareOutput"
    ]:
        import capo_service_catalog._operations.aws242_service_catalog_service.update_portfolio_share

        output, http_response = (
            capo_service_catalog._operations.aws242_service_catalog_service.update_portfolio_share.update_portfolio_share(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdatePortfolioShare")
    )
    input_: capo_service_catalog.types.update_portfolio_share_input.UpdatePortfolioShareInput = {
        "portfolio_id": portfolio_id
    }
    if accept_language is not None:
        input_["accept_language"] = accept_language
    if account_id is not None:
        input_["account_id"] = account_id
    if organization_node is not None:
        input_["organization_node"] = organization_node
    if share_tag_options is not None:
        input_["share_tag_options"] = share_tag_options
    if share_principals is not None:
        input_["share_principals"] = share_principals

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output