Skip to content

update_campaign async

update_campaign(
    catalog: Catalog,
    campaign_identifier: CampaignIdentifier,
    *,
    config_overrides: Optional[AsyncPartnerCentralMarketingClientConfig] = None,
    name: Optional[CampaignName] = None,
    sender_email: Optional[SenderEmail] = None,
    privacy_policy_url: Optional[PrivacyPolicyUrl] = None,
    partner_address: Optional[PartnerAddress] = None,
    partner_badge: Optional[FileRef] = None,
    email_target: Optional[FileRef] = None,
    email_target_engagement_group_ids: Optional[EngagementGroupIdList] = None,
    social_connections: Optional[CampaignSocialConnections] = None,
    estimated_budget: Optional[MonetaryValue] = None,
    total_budget: Optional[MonetaryValue] = None,
    target_audience: Optional[TargetAudience] = None,
    client_token: Optional[ClientToken] = None,
    start_on: Optional[UtcDate] = None,
    end_on: Optional[UtcDate] = None,
) -> UpdateCampaignResponse

Edits a campaign in place. Partial update: an omitted field is left unchanged, which is the standard meaning of an Update verb — a full replacement would be a Put. Change-only, with no way to clear a field back to empty, because the campaign's file members cannot round-trip: they are written as an s3:// reference and read back as a URL or as metadata, so a replacement payload could not resend an unchanged recipient list without re-uploading it. Refused while an activation task runs (CAMPAIGN_ACTIVATION_IN_PROGRESS) and once the campaign is completed (CAMPAIGN_COMPLETED, the UTC date is after its EndOn). Last-writer-wins, with no concurrency token: this is low-contention metadata owned by one partner.

Parameters:

  • catalog (Catalog) –

    The catalog (AWS or Sandbox).

  • campaign_identifier (CampaignIdentifier) –

    The campaign identifier.

  • name (Optional[CampaignName], default: None ) –

    The display name.

  • sender_email (Optional[SenderEmail], default: None ) –

    Sets or replaces the address the campaign's emails are sent from. Checked by the same three rules as on CreateCampaign, with the same codes, but only when it differs, ignoring case, from the stored sender: re-sending the stored one is not checked, and StartCampaignAssetActivationTask re-checks it before an email activates.

    Replaces, never clears: like every member of this operation, an omitted value leaves the sender as it was, and there is no way to remove one once set.

  • privacy_policy_url (Optional[PrivacyPolicyUrl], default: None ) –

    Sets or replaces the URL of the partner's privacy policy. Replaces, never clears.

  • partner_address (Optional[PartnerAddress], default: None ) –

    Sets or replaces the partner's postal address. Replaces, never clears.

  • partner_badge (Optional[FileRef], default: None ) –

    Sets or replaces the partner's badge, checked exactly as on CreateCampaign. Replaces, never clears: upload the Standalone AWS Partner badge to show it again. The badge an asset already published keeps showing on it until that asset is activated again.

  • email_target (Optional[FileRef], default: None ) –

    Replaces the campaign's attached recipient list.

    The referenced object is copied and pinned again on every call that supplies it, so the pinned copy always reflects the last UpdateCampaign that named one. Editing the source object in your own bucket without calling this operation again has no effect.

    Replaces, never detaches: a partner can swap the list but cannot remove it.

  • email_target_engagement_group_ids (Optional[EngagementGroupIdList], default: None ) –

    Engagement groups whose contacts the campaign's emails will also go to (see CreateCampaign). Replaces the stored list; never clears it.

    As on CreateCampaign: each group once (INVALID_VALUE otherwise), not checked against your groups when saved, and resolved at Start where the stage can (ENGAGEMENT_GROUPS_UNAVAILABLE where it can't).

  • social_connections (Optional[CampaignSocialConnections], default: None ) –

    Sets the account the campaign's social posts publish from, per platform. Each platform named replaces that platform's choice; a platform not named keeps its own. Replaces, never clears.

    Not checked against your connections here: a connection can be deleted at any time, so the activation checks the choice. See Campaign$SocialConnections.

  • estimated_budget (Optional[MonetaryValue], default: None ) –

    What the partner expects the campaign to cost.

  • total_budget (Optional[MonetaryValue], default: None ) –

    The campaign's total budget.

  • target_audience (Optional[TargetAudience], default: None ) –

    Target audience configuration.

  • client_token (Optional[ClientToken], default: None ) –

    Idempotency token. Accepted and not stored: this is a change-only partial update with last-writer-wins, so re-applying the same call produces the same result and the same response. There is nothing a replay cache would protect.

  • start_on (Optional[UtcDate], default: None ) –

    The first day of the campaign's run window. Not after EndOn (ValidationException, INVALID_VALUE).

  • end_on (Optional[UtcDate], default: None ) –

    The last day of the campaign's run window, inclusive and in UTC. Editable only while the campaign is open, like everything else here: once the stored EndOn has passed the campaign is completed and this update is refused (CAMPAIGN_COMPLETED). Refused with ValidationException (INVALID_VALUE) when it is in the past, or earlier than the day of a scheduled send on one of the campaign's assets: move or cancel that send first. Setting it to today ends the campaign at the next UTC midnight.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action. An IAM denial carries no Reason. A refusal for the caller's Partner Central state carries one, so a client tells the two apart by its presence.

  • InternalServerException –

    An unexpected error occurred during the processing of the request.

  • ThrottlingException –

    The request was denied due to request throttling.

  • ValidationException –

    The input fails to satisfy the constraints specified by the service. A caller branches on Reason, and where the rejection is attributable to particular fields it reads FieldList rather than parsing Message, which is prose and may change.

  • ConflictException –

    The request conflicts with the current state of the resource.

  • ResourceNotFoundException –

    The specified resource does not exist.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Rename a campaign and raise its budget

>>> await client.update_campaign(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', name='Q4 GenAI Campaign (EMEA)', total_budget={'Amount': '40000.00', 'CurrencyCode': 'USD'})
Source code in docs_src/capo_partnercentral_marketing/_services/async_partner_central_marketing.py
async def update_campaign(
    self,
    catalog: "capo_partnercentral_marketing.types.catalog.Catalog",
    campaign_identifier: "capo_partnercentral_marketing.types.campaign_identifier.CampaignIdentifier",
    *,
    config_overrides: Optional[AsyncPartnerCentralMarketingClientConfig] = None,
    name: Optional[
        "capo_partnercentral_marketing.types.campaign_name.CampaignName"
    ] = None,
    sender_email: Optional[
        "capo_partnercentral_marketing.types.sender_email.SenderEmail"
    ] = None,
    privacy_policy_url: Optional[
        "capo_partnercentral_marketing.types.privacy_policy_url.PrivacyPolicyUrl"
    ] = None,
    partner_address: Optional[
        "capo_partnercentral_marketing.types.partner_address.PartnerAddress"
    ] = None,
    partner_badge: Optional[
        "capo_partnercentral_marketing.types.file_ref.FileRef"
    ] = None,
    email_target: Optional[
        "capo_partnercentral_marketing.types.file_ref.FileRef"
    ] = None,
    email_target_engagement_group_ids: Optional[
        "capo_partnercentral_marketing.types.engagement_group_id_list.EngagementGroupIdList"
    ] = None,
    social_connections: Optional[
        "capo_partnercentral_marketing.types.campaign_social_connections.CampaignSocialConnections"
    ] = None,
    estimated_budget: Optional[
        "capo_partnercentral_marketing.types.monetary_value.MonetaryValue"
    ] = None,
    total_budget: Optional[
        "capo_partnercentral_marketing.types.monetary_value.MonetaryValue"
    ] = None,
    target_audience: Optional[
        "capo_partnercentral_marketing.types.target_audience.TargetAudience"
    ] = None,
    client_token: Optional[
        "capo_partnercentral_marketing.types.client_token.ClientToken"
    ] = None,
    start_on: Optional[
        "capo_partnercentral_marketing.types.utc_date.UtcDate"
    ] = None,
    end_on: Optional["capo_partnercentral_marketing.types.utc_date.UtcDate"] = None,
) -> "capo_partnercentral_marketing.types.update_campaign_response.UpdateCampaignResponse":
    """Edits a campaign in place. Partial update: an omitted field is left unchanged, which is the standard meaning of an `Update` verb — a full replacement would be a `Put`. Change-only, with no way to clear a field back to empty, because the campaign's file members cannot round-trip: they are written as an `s3://` reference and read back as a URL or as metadata, so a replacement payload could not resend an unchanged recipient list without re-uploading it. Refused while an activation task runs (`CAMPAIGN_ACTIVATION_IN_PROGRESS`) and once the campaign is completed (`CAMPAIGN_COMPLETED`, the UTC date is after its `EndOn`). Last-writer-wins, with no concurrency token: this is low-contention metadata owned by one partner.

    Args:
        catalog: The catalog (AWS or Sandbox).
        campaign_identifier: The campaign identifier.
        name: The display name.
        sender_email: Sets or replaces the address the campaign's emails are sent from. Checked by the same three rules as on `CreateCampaign`, with the same codes, but only when it differs, ignoring case, from the stored sender: re-sending the stored one is not checked, and `StartCampaignAssetActivationTask` re-checks it before an email activates. <p>Replaces, never clears: like every member of this operation, an omitted value leaves the sender as it was, and there is no way to remove one once set.
        privacy_policy_url: Sets or replaces the URL of the partner's privacy policy. Replaces, never clears.
        partner_address: Sets or replaces the partner's postal address. Replaces, never clears.
        partner_badge: Sets or replaces the partner's badge, checked exactly as on `CreateCampaign`. Replaces, never clears: upload the Standalone AWS Partner badge to show it again. The badge an asset already published keeps showing on it until that asset is activated again.
        email_target: Replaces the campaign's attached recipient list. <p>The referenced object is copied and pinned again on every call that supplies it, so the pinned copy always reflects the *last* `UpdateCampaign` that named one. Editing the source object in your own bucket without calling this operation again has no effect. <p>Replaces, never detaches: a partner can swap the list but cannot remove it.
        email_target_engagement_group_ids: Engagement groups whose contacts the campaign's emails will also go to (see `CreateCampaign`). Replaces the stored list; never clears it. <p>As on `CreateCampaign`: each group once (`INVALID_VALUE` otherwise), not checked against your groups when saved, and resolved at Start where the stage can (`ENGAGEMENT_GROUPS_UNAVAILABLE` where it can't).
        social_connections: Sets the account the campaign's social posts publish from, per platform. Each platform named replaces that platform's choice; a platform not named keeps its own. Replaces, never clears. <p>Not checked against your connections here: a connection can be deleted at any time, so the activation checks the choice. See `Campaign$SocialConnections`.
        estimated_budget: What the partner expects the campaign to cost.
        total_budget: The campaign's total budget.
        target_audience: Target audience configuration.
        client_token: Idempotency token. Accepted and not stored: this is a change-only partial update with last-writer-wins, so re-applying the same call produces the same result and the same response. There is nothing a replay cache would protect.
        start_on: The first day of the campaign's run window. Not after `EndOn` (`ValidationException`, `INVALID_VALUE`).
        end_on: The last day of the campaign's run window, inclusive and in UTC. Editable only while the campaign is open, like everything else here: once the stored `EndOn` has passed the campaign is completed and this update is refused (`CAMPAIGN_COMPLETED`). Refused with `ValidationException` (`INVALID_VALUE`) when it is in the past, or earlier than the day of a scheduled send on one of the campaign's assets: move or cancel that send first. Setting it to today ends the campaign at the next UTC midnight.

    Raises:
        capo_partnercentral_marketing.errors.access_denied_exception.AccessDeniedException: You do not have sufficient access to perform this action. An IAM denial carries no `Reason`. A refusal for the caller's Partner Central state carries one, so a client tells the two apart by its presence.
        capo_partnercentral_marketing.errors.internal_server_exception.InternalServerException: An unexpected error occurred during the processing of the request.
        capo_partnercentral_marketing.errors.throttling_exception.ThrottlingException: The request was denied due to request throttling.
        capo_partnercentral_marketing.errors.validation_exception.ValidationException: The input fails to satisfy the constraints specified by the service. A caller branches on `Reason`, and where the rejection is attributable to particular fields it reads `FieldList` rather than parsing `Message`, which is prose and may change.
        capo_partnercentral_marketing.errors.conflict_exception.ConflictException: The request conflicts with the current state of the resource.
        capo_partnercentral_marketing.errors.resource_not_found_exception.ResourceNotFoundException: The specified resource does not exist.
        capo_partnercentral_marketing.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Rename a campaign and raise its budget

        >>> await client.update_campaign(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', name='Q4 GenAI Campaign (EMEA)', total_budget={'Amount': '40000.00', 'CurrencyCode': 'USD'})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_partnercentral_marketing.types.update_campaign_request.UpdateCampaignRequest]",
    ) -> AsyncOperationResponse[
        "capo_partnercentral_marketing.types.update_campaign_response.UpdateCampaignResponse"
    ]:
        import capo_partnercentral_marketing._operations.aws_partner_demand_generator.update_campaign

        (
            output,
            http_response,
        ) = await capo_partnercentral_marketing._operations.aws_partner_demand_generator.update_campaign.async_update_campaign(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_partnercentral_marketing.types.update_campaign_request.UpdateCampaignRequest",
    ) -> dict[str, Any]:
        import capo_partnercentral_marketing.types.update_campaign_request

        return capo_partnercentral_marketing.types.update_campaign_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UpdateCampaign", redact_input=_redact_input),
    )
    input_: capo_partnercentral_marketing.types.update_campaign_request.UpdateCampaignRequest = {
        "catalog": catalog,
        "campaign_identifier": campaign_identifier,
    }
    if name is not None:
        input_["name"] = name
    if sender_email is not None:
        input_["sender_email"] = sender_email
    if privacy_policy_url is not None:
        input_["privacy_policy_url"] = privacy_policy_url
    if partner_address is not None:
        input_["partner_address"] = partner_address
    if partner_badge is not None:
        input_["partner_badge"] = partner_badge
    if email_target is not None:
        input_["email_target"] = email_target
    if email_target_engagement_group_ids is not None:
        input_["email_target_engagement_group_ids"] = (
            email_target_engagement_group_ids
        )
    if social_connections is not None:
        input_["social_connections"] = social_connections
    if estimated_budget is not None:
        input_["estimated_budget"] = estimated_budget
    if total_budget is not None:
        input_["total_budget"] = total_budget
    if target_audience is not None:
        input_["target_audience"] = target_audience
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if start_on is not None:
        input_["start_on"] = start_on
    if end_on is not None:
        input_["end_on"] = end_on

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output