Skip to content

update_constraint

update_constraint(
    id: Id,
    *,
    config_overrides: Optional[ServiceCatalogClientConfig] = None,
    accept_language: Optional[AcceptLanguage] = None,
    description: Optional[ConstraintDescription] = None,
    parameters: Optional[ConstraintParameters] = None,
) -> UpdateConstraintOutput

Updates the specified constraint.

Parameters:

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

    The language code.

    • jp - Japanese

    • zh - Chinese

  • id (Id) –

    The identifier of the constraint.

  • description (Optional[ConstraintDescription], default: None ) –

    The updated description of the constraint.

  • parameters (Optional[ConstraintParameters], default: None ) –

    The constraint parameters, in JSON format. The syntax depends on the constraint type as follows:

    LAUNCH

    You are required to specify either the RoleArn or the LocalRoleName but can't use both.

    Specify the RoleArn property as follows:

    {"RoleArn" : "arn:aws:iam::123456789012:role/LaunchRole"}

    Specify the LocalRoleName property as follows:

    {"LocalRoleName": "SCBasicLaunchRole"}

    If you specify the LocalRoleName property, when an account uses the launch constraint, the IAM role with that name in the account will be used. This allows launch-role constraints to be account-agnostic so the administrator can create fewer resources per shared account.

    The given role name must exist in the account used to create the launch constraint and the account of the user who launches a product with this launch constraint.

    You cannot have both a LAUNCH and a STACKSET constraint.

    You also cannot have more than one LAUNCH constraint on a product and portfolio.

    NOTIFICATION

    Specify the NotificationArns property as follows:

    {"NotificationArns" : ["arn:aws:sns:us-east-1:123456789012:Topic"]}

    RESOURCE_UPDATE

    Specify the TagUpdatesOnProvisionedProduct property as follows:

    {"Version":"2.0","Properties":{"TagUpdateOnProvisionedProduct":"String"}}

    The TagUpdatesOnProvisionedProduct property accepts a string value of ALLOWED or NOT_ALLOWED.

    STACKSET

    Specify the Parameters property as follows:

    {"Version": "String", "Properties": {"AccountList": [ "String" ], "RegionList": [ "String" ], "AdminRole": "String", "ExecutionRole": "String"}}

    You cannot have both a LAUNCH and a STACKSET constraint.

    You also cannot have more than one STACKSET constraint on a product and portfolio.

    Products with a STACKSET constraint will launch an CloudFormation stack set.

    TEMPLATE

    Specify the Rules property. For more information, see Template Constraint Rules.

Raises:

Source code in docs_src/capo_service_catalog/_services/service_catalog.py
def update_constraint(
    self,
    id: "capo_service_catalog.types.id.Id",
    *,
    config_overrides: Optional[ServiceCatalogClientConfig] = None,
    accept_language: Optional[
        "capo_service_catalog.types.accept_language.AcceptLanguage"
    ] = None,
    description: Optional[
        "capo_service_catalog.types.constraint_description.ConstraintDescription"
    ] = None,
    parameters: Optional[
        "capo_service_catalog.types.constraint_parameters.ConstraintParameters"
    ] = None,
) -> "capo_service_catalog.types.update_constraint_output.UpdateConstraintOutput":
    """<p>Updates the specified constraint.</p>

    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>
        id: <p>The identifier of the constraint.</p>
        description: <p>The updated description of the constraint.</p>
        parameters: <p>The constraint parameters, in JSON format. The syntax depends on the constraint type as follows:</p> <dl> <dt>LAUNCH</dt> <dd> <p>You are required to specify either the <code>RoleArn</code> or the <code>LocalRoleName</code> but can't use both.</p> <p>Specify the <code>RoleArn</code> property as follows:</p> <p> <code>{"RoleArn" : "arn:aws:iam::123456789012:role/LaunchRole"}</code> </p> <p>Specify the <code>LocalRoleName</code> property as follows:</p> <p> <code>{"LocalRoleName": "SCBasicLaunchRole"}</code> </p> <p>If you specify the <code>LocalRoleName</code> property, when an account uses the launch constraint, the IAM role with that name in the account will be used. This allows launch-role constraints to be account-agnostic so the administrator can create fewer resources per shared account.</p> <note> <p>The given role name must exist in the account used to create the launch constraint and the account of the user who launches a product with this launch constraint.</p> </note> <p>You cannot have both a <code>LAUNCH</code> and a <code>STACKSET</code> constraint.</p> <p>You also cannot have more than one <code>LAUNCH</code> constraint on a product and portfolio.</p> </dd> <dt>NOTIFICATION</dt> <dd> <p>Specify the <code>NotificationArns</code> property as follows:</p> <p> <code>{"NotificationArns" : ["arn:aws:sns:us-east-1:123456789012:Topic"]}</code> </p> </dd> <dt>RESOURCE_UPDATE</dt> <dd> <p>Specify the <code>TagUpdatesOnProvisionedProduct</code> property as follows:</p> <p> <code>{"Version":"2.0","Properties":{"TagUpdateOnProvisionedProduct":"String"}}</code> </p> <p>The <code>TagUpdatesOnProvisionedProduct</code> property accepts a string value of <code>ALLOWED</code> or <code>NOT_ALLOWED</code>.</p> </dd> <dt>STACKSET</dt> <dd> <p>Specify the <code>Parameters</code> property as follows:</p> <p> <code>{"Version": "String", "Properties": {"AccountList": [ "String" ], "RegionList": [ "String" ], "AdminRole": "String", "ExecutionRole": "String"}}</code> </p> <p>You cannot have both a <code>LAUNCH</code> and a <code>STACKSET</code> constraint.</p> <p>You also cannot have more than one <code>STACKSET</code> constraint on a product and portfolio.</p> <p>Products with a <code>STACKSET</code> constraint will launch an CloudFormation stack set.</p> </dd> <dt>TEMPLATE</dt> <dd> <p>Specify the <code>Rules</code> property. For more information, see <a href="http://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html">Template Constraint Rules</a>.</p> </dd> </dl>

    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.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_constraint_input.UpdateConstraintInput]",
    ) -> OperationResponse[
        "capo_service_catalog.types.update_constraint_output.UpdateConstraintOutput"
    ]:
        import capo_service_catalog._operations.aws242_service_catalog_service.update_constraint

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateConstraint")
    )
    input_: capo_service_catalog.types.update_constraint_input.UpdateConstraintInput = {
        "id": id
    }
    if accept_language is not None:
        input_["accept_language"] = accept_language
    if description is not None:
        input_["description"] = description
    if parameters is not None:
        input_["parameters"] = parameters

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