Skip to content

update_continuous_deployment_policy

update_continuous_deployment_policy(
    continuous_deployment_policy_config: ContinuousDeploymentPolicyConfig,
    id: string,
    *,
    config_overrides: Optional[CloudFrontClientConfig] = None,
    if_match: Optional[string] = None,
) -> UpdateContinuousDeploymentPolicyResult

Updates a continuous deployment policy. You can update a continuous deployment policy to enable or disable it, to change the percentage of traffic that it sends to the staging distribution, or to change the staging distribution that it sends traffic to.

When you update a continuous deployment policy configuration, all the fields are updated with the values that are provided in the request. You cannot update some fields independent of others. To update a continuous deployment policy configuration:

  1. Use GetContinuousDeploymentPolicyConfig to get the current configuration.

  2. Locally modify the fields in the continuous deployment policy configuration that you want to update.

  3. Use UpdateContinuousDeploymentPolicy, providing the entire continuous deployment policy configuration, including the fields that you modified and those that you didn't.

Parameters:

  • continuous_deployment_policy_config (ContinuousDeploymentPolicyConfig) –

    The continuous deployment policy configuration.

  • id (string) –

    The identifier of the continuous deployment policy that you are updating.

  • if_match (Optional[string], default: None ) –

    The current version (ETag value) of the continuous deployment policy that you are updating.

Raises:

Source code in docs_src/capo_cloudfront/_services/cloud_front.py
def update_continuous_deployment_policy(
    self,
    continuous_deployment_policy_config: "capo_cloudfront.types.continuous_deployment_policy_config.ContinuousDeploymentPolicyConfig",
    id: "capo_cloudfront.types.string.string",
    *,
    config_overrides: Optional[CloudFrontClientConfig] = None,
    if_match: Optional["capo_cloudfront.types.string.string"] = None,
) -> "capo_cloudfront.types.update_continuous_deployment_policy_result.UpdateContinuousDeploymentPolicyResult":
    """<p>Updates a continuous deployment policy. You can update a continuous deployment policy to enable or disable it, to change the percentage of traffic that it sends to the staging distribution, or to change the staging distribution that it sends traffic to.</p> <p>When you update a continuous deployment policy configuration, all the fields are updated with the values that are provided in the request. You cannot update some fields independent of others. To update a continuous deployment policy configuration:</p> <ol> <li> <p>Use <code>GetContinuousDeploymentPolicyConfig</code> to get the current configuration.</p> </li> <li> <p>Locally modify the fields in the continuous deployment policy configuration that you want to update.</p> </li> <li> <p>Use <code>UpdateContinuousDeploymentPolicy</code>, providing the entire continuous deployment policy configuration, including the fields that you modified and those that you didn't.</p> </li> </ol>

    Args:
        continuous_deployment_policy_config: <p>The continuous deployment policy configuration.</p>
        id: <p>The identifier of the continuous deployment policy that you are updating.</p>
        if_match: <p>The current version (<code>ETag</code> value) of the continuous deployment policy that you are updating.</p>

    Raises:
        capo_cloudfront.errors.access_denied.AccessDenied: <p>Access denied.</p>
        capo_cloudfront.errors.inconsistent_quantities.InconsistentQuantities: <p>The value of <code>Quantity</code> and the size of <code>Items</code> don't match.</p>
        capo_cloudfront.errors.invalid_argument.InvalidArgument: <p>An argument is invalid.</p>
        capo_cloudfront.errors.invalid_if_match_version.InvalidIfMatchVersion: <p>The <code>If-Match</code> version is missing or not valid.</p>
        capo_cloudfront.errors.no_such_continuous_deployment_policy.NoSuchContinuousDeploymentPolicy: <p>The continuous deployment policy doesn't exist.</p>
        capo_cloudfront.errors.precondition_failed.PreconditionFailed: <p>The precondition in one or more of the request fields evaluated to <code>false</code>.</p>
        capo_cloudfront.errors.staging_distribution_in_use.StagingDistributionInUse: <p>A continuous deployment policy for this staging distribution already exists.</p>
        capo_cloudfront.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudfront.types.update_continuous_deployment_policy_request.UpdateContinuousDeploymentPolicyRequest]",
    ) -> OperationResponse[
        "capo_cloudfront.types.update_continuous_deployment_policy_result.UpdateContinuousDeploymentPolicyResult"
    ]:
        import capo_cloudfront._operations.cloudfront2020_05_31.update_continuous_deployment_policy

        output, http_response = (
            capo_cloudfront._operations.cloudfront2020_05_31.update_continuous_deployment_policy.update_continuous_deployment_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateContinuousDeploymentPolicy")
    )
    input_: capo_cloudfront.types.update_continuous_deployment_policy_request.UpdateContinuousDeploymentPolicyRequest = {
        "continuous_deployment_policy_config": continuous_deployment_policy_config,
        "id": id,
    }
    if if_match is not None:
        input_["if_match"] = if_match

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