Skip to content

update_campaign_asset

update_campaign_asset(
    catalog: Catalog,
    campaign_identifier: CampaignIdentifier,
    campaign_asset_identifier: CampaignAssetId,
    *,
    config_overrides: Optional[PartnerCentralMarketingClientConfig] = None,
    field_values: Optional[FieldValueInputList] = None,
    layout: Optional[LayoutOptionValue] = None,
    send_mode: Optional[SendMode] = None,
    scheduled_send_at: Optional[Timestamp] = None,
    client_token: Optional[ClientToken] = None,
) -> UpdateCampaignAssetResponse

Updates an asset's field values, layout or send time. Refused with ConflictException while the campaign's running activation task still owns the asset (ASSET_START_IN_PROGRESS), and for a live email or social post (ASSET_ALREADY_ACTIVE): deactivate it first.

    Args:
        catalog: The catalog (AWS or Sandbox).
        campaign_identifier: The campaign identifier.
        campaign_asset_identifier: The asset identifier.
        field_values: Value-only updates to the asset's pinned template fields, keyed by FieldId. The field schema (labels, descriptions, constraints, placeholders, image defaults) is service-owned and pinned at instantiation, so clients send only the values they are changing. Fields omitted keep their stored values; send the entry with `Value` omitted to clear one. Named `FieldValues` to match the member it edits on `CampaignAsset`, which is the same concept read back. It was `templateFieldUpdates`; the two names for one concept were the defect, not the length.
        layout: Selects a multi-layout asset's layout: one of the values in `CampaignAsset.layout.options`. PATCH: omitted leaves the selection unchanged, and there is no way to clear it. A value that is not one of the asset's options — or any value on a single-layout asset — is a plain `ValidationException`, and nothing in the call is applied. Every pinned field stays writable whichever layout is selected.
        send_mode: When a **sendable** asset (`EMAIL`, `SOCIAL_POST`) sends: on activation, or at `ScheduledSendAt`. A mode beside a value rather than a union, on purpose: `ScheduledSendAt` stays a plain `Timestamp`, and the precedent is EventBridge Scheduler's `FlexibleTimeWindow { Mode, MaximumWindowInMinutes }`. The pair is checked as one, and a request where they disagree is refused with `ValidationException` (`INVALID_VALUE`, naming the member) and applies nothing: - `SCHEDULED` requires `ScheduledSendAt`; a reschedule resends `SCHEDULED` with the new time; - `ON_ACTIVATION` forbids `ScheduledSendAt`, and drops any time already stored; - `ScheduledSendAt` without `SendMode` is refused. PATCH: omitted leaves both unchanged. Until a mode is chosen the asset reports `SEND_MODE_MISSING` and does not activate: no default, because an unchosen send mails the real audience. Rejected with `ValidationException` (`NOT_SUPPORTED_FOR_CATEGORY`) for a category that has no send (`LANDING_PAGE`, `DOCUMENT`, `BANNER_AD`). Like every other edit, it reaches the delivery platform at the asset's next activation, and a live email or social post refuses it (`ASSET_ALREADY_ACTIVE`): deactivate first.
        scheduled_send_at: The send time, with `SendMode: SCHEDULED` and only then. See `SendMode`. Must be at least an hour out (`SEND_WINDOW_TOO_SOON`), unless it is the time already stored: resending the stored mode and time changes nothing and is accepted, so a form that always resubmits does not trip the window. Must also fall on or before the campaign's `EndOn` (by the end of that UTC day): refused with `ValidationException` (`INVALID_VALUE`) otherwise, so nothing is scheduled to send after the campaign completes. Was `scheduleDate`, a `YYYY-MM-DD` string. Retyped because a date alone cannot express a send *time*, which is the whole point of a schedule — and because the resource already spelled the same concept `ScheduledSendAt` on the activation responses. Two spellings of one concept on one resource was the defect.
        client_token: Idempotency token. Retry-safety only — this is **not** a concurrency token, and sequential edits to one field are last-writer-wins.

    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:
        Update asset content

        >>> client.update_campaign_asset(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', campaign_asset_identifier='ast-4b81e0c9f2a7b', field_values=[{'FieldId': 'Subject', 'Value': {'Text': 'New subject line'}}])
        Reschedule a sendable asset

        >>> client.update_campaign_asset(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', campaign_asset_identifier='ast-4b81e0c9f2a7b', send_mode='SCHEDULED', scheduled_send_at=1793491200, client_token='f2a7c1e4-9b3d-4a51-8e6f-0c2d5b8a7e13')
        Copy an image from a previous campaign's asset
        The image already stored on another of your assets is copied into this field. It is checked

against this field's constraints and not scanned again. The call also needs partnercentral:GetCampaignAsset on the source campaign.

        >>> client.update_campaign_asset(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', campaign_asset_identifier='ast-4b81e0c9f2a7b', field_values=[{'FieldId': 'HeaderImage', 'Value': {'CampaignAssetImage': {'CampaignIdentifier': 'camp-2Lp7d9f3j6s1z', 'CampaignAssetIdentifier': 'ast-0f9e8d7c6b5a2', 'FieldId': 'HeaderImage'}}}])
        Use a suggested image from Build with AI
        The URL Build with AI returned for a suggested image is sent unchanged as imageReference. The

image is copied into this asset and not scanned. Any other URL is refused.

        >>> client.update_campaign_asset(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', campaign_asset_identifier='ast-4b81e0c9f2a7b', field_values=[{'FieldId': 'HeaderImage', 'Value': {'ImageReference': 'https://d111111abcdef8.cloudfront.net/suggested-image-url-from-build-with-ai.jpg'}}])
        An update refused for two fields at once
        Every failed field is reported in one refusal, and nothing applies — a declined image and an

over-long headline arrive together in fieldList, each with its own code. This replaced a read-path fileDetails[] report (DG-040 Decision 11), so a partner handles image and text failures the same way.

        >>> client.update_campaign_asset(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', campaign_asset_identifier='ast-4b81e0c9f2a7b', field_values=[{'FieldId': 'HeaderImage', 'Value': {'ImageReference': 's3://staging-bucket/123456789012/hero.png?versionId=v1'}}, {'FieldId': 'Headline', 'Value': {'Text': 'This headline is far longer than the field allows'}}])
Source code in docs_src/capo_partnercentral_marketing/_services/partner_central_marketing.py
def update_campaign_asset(
    self,
    catalog: "capo_partnercentral_marketing.types.catalog.Catalog",
    campaign_identifier: "capo_partnercentral_marketing.types.campaign_identifier.CampaignIdentifier",
    campaign_asset_identifier: "capo_partnercentral_marketing.types.campaign_asset_id.CampaignAssetId",
    *,
    config_overrides: Optional[PartnerCentralMarketingClientConfig] = None,
    field_values: Optional[
        "capo_partnercentral_marketing.types.field_value_input_list.FieldValueInputList"
    ] = None,
    layout: Optional[
        "capo_partnercentral_marketing.types.layout_option_value.LayoutOptionValue"
    ] = None,
    send_mode: Optional[
        "capo_partnercentral_marketing.types.send_mode.SendMode"
    ] = None,
    scheduled_send_at: Optional[
        "capo_partnercentral_marketing.types.timestamp.Timestamp"
    ] = None,
    client_token: Optional[
        "capo_partnercentral_marketing.types.client_token.ClientToken"
    ] = None,
) -> "capo_partnercentral_marketing.types.update_campaign_asset_response.UpdateCampaignAssetResponse":
    """Updates an asset's field values, layout or send time. Refused with `ConflictException` while the campaign's running activation task still owns the asset (`ASSET_START_IN_PROGRESS`), and for a live email or social post (`ASSET_ALREADY_ACTIVE`): deactivate it first.

            Args:
                catalog: The catalog (AWS or Sandbox).
                campaign_identifier: The campaign identifier.
                campaign_asset_identifier: The asset identifier.
                field_values: Value-only updates to the asset's pinned template fields, keyed by FieldId. The field schema (labels, descriptions, constraints, placeholders, image defaults) is service-owned and pinned at instantiation, so clients send only the values they are changing. Fields omitted keep their stored values; send the entry with `Value` omitted to clear one. Named `FieldValues` to match the member it edits on `CampaignAsset`, which is the same concept read back. It was `templateFieldUpdates`; the two names for one concept were the defect, not the length.
                layout: Selects a multi-layout asset's layout: one of the values in `CampaignAsset.layout.options`. PATCH: omitted leaves the selection unchanged, and there is no way to clear it. A value that is not one of the asset's options — or any value on a single-layout asset — is a plain `ValidationException`, and nothing in the call is applied. Every pinned field stays writable whichever layout is selected.
                send_mode: When a **sendable** asset (`EMAIL`, `SOCIAL_POST`) sends: on activation, or at `ScheduledSendAt`. A mode beside a value rather than a union, on purpose: `ScheduledSendAt` stays a plain `Timestamp`, and the precedent is EventBridge Scheduler's `FlexibleTimeWindow { Mode, MaximumWindowInMinutes }`. The pair is checked as one, and a request where they disagree is refused with `ValidationException` (`INVALID_VALUE`, naming the member) and applies nothing: - `SCHEDULED` requires `ScheduledSendAt`; a reschedule resends `SCHEDULED` with the new time; - `ON_ACTIVATION` forbids `ScheduledSendAt`, and drops any time already stored; - `ScheduledSendAt` without `SendMode` is refused. PATCH: omitted leaves both unchanged. Until a mode is chosen the asset reports `SEND_MODE_MISSING` and does not activate: no default, because an unchosen send mails the real audience. Rejected with `ValidationException` (`NOT_SUPPORTED_FOR_CATEGORY`) for a category that has no send (`LANDING_PAGE`, `DOCUMENT`, `BANNER_AD`). Like every other edit, it reaches the delivery platform at the asset's next activation, and a live email or social post refuses it (`ASSET_ALREADY_ACTIVE`): deactivate first.
                scheduled_send_at: The send time, with `SendMode: SCHEDULED` and only then. See `SendMode`. Must be at least an hour out (`SEND_WINDOW_TOO_SOON`), unless it is the time already stored: resending the stored mode and time changes nothing and is accepted, so a form that always resubmits does not trip the window. Must also fall on or before the campaign's `EndOn` (by the end of that UTC day): refused with `ValidationException` (`INVALID_VALUE`) otherwise, so nothing is scheduled to send after the campaign completes. Was `scheduleDate`, a `YYYY-MM-DD` string. Retyped because a date alone cannot express a send *time*, which is the whole point of a schedule — and because the resource already spelled the same concept `ScheduledSendAt` on the activation responses. Two spellings of one concept on one resource was the defect.
                client_token: Idempotency token. Retry-safety only — this is **not** a concurrency token, and sequential edits to one field are last-writer-wins.

            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:
                Update asset content

                >>> client.update_campaign_asset(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', campaign_asset_identifier='ast-4b81e0c9f2a7b', field_values=[{'FieldId': 'Subject', 'Value': {'Text': 'New subject line'}}])
                Reschedule a sendable asset

                >>> client.update_campaign_asset(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', campaign_asset_identifier='ast-4b81e0c9f2a7b', send_mode='SCHEDULED', scheduled_send_at=1793491200, client_token='f2a7c1e4-9b3d-4a51-8e6f-0c2d5b8a7e13')
                Copy an image from a previous campaign's asset
                The image already stored on another of your assets is copied into this field. It is checked
    against this field's constraints and not scanned again. The call also needs
    partnercentral:GetCampaignAsset on the source campaign.

                >>> client.update_campaign_asset(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', campaign_asset_identifier='ast-4b81e0c9f2a7b', field_values=[{'FieldId': 'HeaderImage', 'Value': {'CampaignAssetImage': {'CampaignIdentifier': 'camp-2Lp7d9f3j6s1z', 'CampaignAssetIdentifier': 'ast-0f9e8d7c6b5a2', 'FieldId': 'HeaderImage'}}}])
                Use a suggested image from Build with AI
                The URL Build with AI returned for a suggested image is sent unchanged as imageReference. The
    image is copied into this asset and not scanned. Any other URL is refused.

                >>> client.update_campaign_asset(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', campaign_asset_identifier='ast-4b81e0c9f2a7b', field_values=[{'FieldId': 'HeaderImage', 'Value': {'ImageReference': 'https://d111111abcdef8.cloudfront.net/suggested-image-url-from-build-with-ai.jpg'}}])
                An update refused for two fields at once
                Every failed field is reported in one refusal, and nothing applies — a declined image and an
    over-long headline arrive together in `fieldList`, each with its own `code`. This replaced a
    read-path `fileDetails[]` report (DG-040 Decision 11), so a partner handles image and text
    failures the same way.

                >>> client.update_campaign_asset(catalog='AWS', campaign_identifier='camp-5Hq2m8x4k1p9w', campaign_asset_identifier='ast-4b81e0c9f2a7b', field_values=[{'FieldId': 'HeaderImage', 'Value': {'ImageReference': 's3://staging-bucket/123456789012/hero.png?versionId=v1'}}, {'FieldId': 'Headline', 'Value': {'Text': 'This headline is far longer than the field allows'}}])
    """

    def _handler(
        req: "OperationRequest[capo_partnercentral_marketing.types.update_campaign_asset_request.UpdateCampaignAssetRequest]",
    ) -> OperationResponse[
        "capo_partnercentral_marketing.types.update_campaign_asset_response.UpdateCampaignAssetResponse"
    ]:
        import capo_partnercentral_marketing._operations.aws_partner_demand_generator.update_campaign_asset

        output, http_response = (
            capo_partnercentral_marketing._operations.aws_partner_demand_generator.update_campaign_asset.update_campaign_asset(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

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

        return capo_partnercentral_marketing.types.update_campaign_asset_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UpdateCampaignAsset", redact_input=_redact_input),
    )
    input_: capo_partnercentral_marketing.types.update_campaign_asset_request.UpdateCampaignAssetRequest = {
        "catalog": catalog,
        "campaign_identifier": campaign_identifier,
        "campaign_asset_identifier": campaign_asset_identifier,
    }
    if field_values is not None:
        input_["field_values"] = field_values
    if layout is not None:
        input_["layout"] = layout
    if send_mode is not None:
        input_["send_mode"] = send_mode
    if scheduled_send_at is not None:
        input_["scheduled_send_at"] = scheduled_send_at
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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