Skip to content

GuardrailTopicPolicyAssessment dataclass

A behavior assessment of a topic policy.

Source code in src/aws_sdk_bedrock_runtime/models.py
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
@dataclass(kw_only=True)
class GuardrailTopicPolicyAssessment:
    """A behavior assessment of a topic policy."""

    topics: list[GuardrailTopic]
    """The topics in the assessment."""

    def serialize(self, serializer: ShapeSerializer):
        serializer.write_struct(_SCHEMA_GUARDRAIL_TOPIC_POLICY_ASSESSMENT, self)

    def serialize_members(self, serializer: ShapeSerializer):
        _serialize_guardrail_topic_list(
            serializer,
            _SCHEMA_GUARDRAIL_TOPIC_POLICY_ASSESSMENT.members["topics"],
            self.topics,
        )

    @classmethod
    def deserialize(cls, deserializer: ShapeDeserializer) -> Self:
        return cls(**cls.deserialize_kwargs(deserializer))

    @classmethod
    def deserialize_kwargs(cls, deserializer: ShapeDeserializer) -> dict[str, Any]:
        kwargs: dict[str, Any] = {}

        def _consumer(schema: Schema, de: ShapeDeserializer) -> None:
            match schema.expect_member_index():
                case 0:
                    kwargs["topics"] = _deserialize_guardrail_topic_list(
                        de, _SCHEMA_GUARDRAIL_TOPIC_POLICY_ASSESSMENT.members["topics"]
                    )

                case _:
                    logger.debug("Unexpected member schema: %s", schema)

        deserializer.read_struct(
            _SCHEMA_GUARDRAIL_TOPIC_POLICY_ASSESSMENT, consumer=_consumer
        )
        return kwargs

Attributes

topics instance-attribute

topics: list[GuardrailTopic]

The topics in the assessment.